{"id":"CVE-2025-40186","aliases":["CVE-2025-40186"],"related":[],"kind":"vulnerability","state":"published","title":"tcp: Don't call reqsk_fastopen_remove() in tcp_conn_request().","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: Don't call reqsk_fastopen_remove() in tcp_conn_request().\n\nsyzbot reported the splat below in tcp_conn_request(). [0]\n\nIf a listener is close()d while a TFO socket is being processed in\ntcp_conn_request(), inet_csk_reqsk_queue_add() does not set reqsk->sk\nand calls inet_child_forget(), which calls tcp_disconnect() for the\nTFO socket.\n\nAfter the cited commit, tcp_disconnect() calls reqsk_fastopen_remove(),\nwhere reqsk_put() is called due to !reqsk->sk.\n\nThen, reqsk_fastopen_remove() in tcp_conn_request() decrements the\nlast req->rsk_refcnt and frees reqsk, and __reqsk_free() at the\ndrop_and_free label causes the refcount underflow for the listener\nand double-free of the reqsk.\n\nLet's remove reqsk_fastopen_remove() in tcp_conn_request().\n\nNote that other callers make sure tp->fastopen_rsk is not NULL.\n\n[0]:\nrefcount_t: underflow; use-after-free.\nWARNING: CPU: 12 PID: 5563 at lib/refcount.c:28 refcount_warn_saturate (lib/refcount.c:28)\nModules linked in:\nCPU: 12 UID: 0 PID: 5563 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full)\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025\nRIP: 0010:refcount_warn_saturate (lib/refcount.c:28)\nCode: ab e8 8e b4 98 ff 0f 0b c3 cc cc cc cc cc 80 3d a4 e4 d6 01 00 75 9c c6 05 9b e4 d6 01 01 48 c7 c7 e8 df fb ab e8 6a b4 98 ff <0f> 0b e9 03 5b 76 00 cc 80 3d 7d e4 d6 01 00 0f 85 74 ff ff ff c6\nRSP: 0018:ffffa79fc0304a98 EFLAGS: 00010246\nRAX: d83af4db1c6b3900 RBX: ffff9f65c7a69020 RCX: d83af4db1c6b3900\nRDX: 0000000000000000 RSI: 00000000ffff7fff RDI: ffffffffac78a280\nRBP: 000000009d781b60 R08: 0000000000007fff R09: ffffffffac6ca280\nR10: 0000000000017ffd R11: 0000000000000004 R12: ffff9f65c7b4f100\nR13: ffff9f65c7d23c00 R14: ffff9f65c7d26000 R15: ffff9f65c7a64ef8\nFS:  00007f9f962176c0(0000) GS:ffff9f65fcf00000(0000) knlGS:0000000000000000\nCS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000200000000180 CR3: 000000000dbbe006 CR4: 0000000000372ef0\nCall Trace:\n <IRQ>\n tcp_conn_request (./include/linux/refcount.h:400 ./include/linux/refcount.h:432 ./include/linux/refcount.h:450 ./include/net/sock.h:1965 ./include/net/request_sock.h:131 net/ipv4/tcp_input.c:7301)\n tcp_rcv_state_process (net/ipv4/tcp_input.c:6708)\n tcp_v6_do_rcv (net/ipv6/tcp_ipv6.c:1670)\n tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1906)\n ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:438)\n ip6_input (net/ipv6/ip6_input.c:500)\n ipv6_rcv (net/ipv6/ip6_input.c:311)\n __netif_receive_skb (net/core/dev.c:6104)\n process_backlog (net/core/dev.c:6456)\n __napi_poll (net/core/dev.c:7506)\n net_rx_action (net/core/dev.c:7569 net/core/dev.c:7696)\n handle_softirqs (kernel/softirq.c:579)\n do_softirq (kernel/softirq.c:480)\n </IRQ>","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: Don't call reqsk_fastopen_remove() in tcp_conn_request().\n\nsyzbot reported the splat below in tcp_conn_request(). [0]\n\nIf a listener is close()d while a TFO socket is being processed in\ntcp_conn_request(), inet_csk_reqsk_queue_add() does not set reqsk->sk\nand calls inet_child_forget(), which calls tcp_disconnect() for the\nTFO socket.\n\nAfter the cited commit, tcp_disconnect() calls reqsk_fastopen_remove(),\nwhere reqsk_put() is called due to !reqsk->sk.\n\nThen, reqsk_fastopen_remove() in tcp_conn_request() decrements the\nlast req->rsk_refcnt and frees reqsk, and __reqsk_free() at the\ndrop_and_free label causes the refcount underflow for the listener\nand double-free of the reqsk.\n\nLet's remove reqsk_fastopen_remove() in tcp_conn_request().\n\nNote that other callers make sure tp->fastopen_rsk is not NULL.\n\n[0]:\nrefcount_t: underflow; use-after-free.\nWARNING: CPU: 12 PID: 5563 at lib/refcount.c:28 refcount_warn_saturate (lib/refcount.c:28)\nModules linked in:\nCPU: 12 UID: 0 PID: 5563 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full)\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025\nRIP: 0010:refcount_warn_saturate (lib/refcount.c:28)\nCode: ab e8 8e b4 98 ff 0f 0b c3 cc cc cc cc cc 80 3d a4 e4 d6 01 00 75 9c c6 05 9b e4 d6 01 01 48 c7 c7 e8 df fb ab e8 6a b4 98 ff <0f> 0b e9 03 5b 76 00 cc 80 3d 7d e4 d6 01 00 0f 85 74 ff ff ff c6\nRSP: 0018:ffffa79fc0304a98 EFLAGS: 00010246\nRAX: d83af4db1c6b3900 RBX: ffff9f65c7a69020 RCX: d83af4db1c6b3900\nRDX: 0000000000000000 RSI: 00000000ffff7fff RDI: ffffffffac78a280\nRBP: 000000009d781b60 R08: 0000000000007fff R09: ffffffffac6ca280\nR10: 0000000000017ffd R11: 0000000000000004 R12: ffff9f65c7b4f100\nR13: ffff9f65c7d23c00 R14: ffff9f65c7d26000 R15: ffff9f65c7a64ef8\nFS:  00007f9f962176c0(0000) GS:ffff9f65fcf00000(0000) knlGS:0000000000000000\nCS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000200000000180 CR3: 000000000dbbe006 CR4: 0000000000372ef0\nCall Trace:\n <IRQ>\n tcp_conn_request (./include/linux/refcount.h:400 ./include/linux/refcount.h:432 ./include/linux/refcount.h:450 ./include/net/sock.h:1965 ./include/net/request_sock.h:131 net/ipv4/tcp_input.c:7301)\n tcp_rcv_state_process (net/ipv4/tcp_input.c:6708)\n tcp_v6_do_rcv (net/ipv6/tcp_ipv6.c:1670)\n tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1906)\n ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:438)\n ip6_input (net/ipv6/ip6_input.c:500)\n ipv6_rcv (net/ipv6/ip6_input.c:311)\n __netif_receive_skb (net/core/dev.c:6104)\n process_backlog (net/core/dev.c:6456)\n __napi_poll (net/core/dev.c:7506)\n net_rx_action (net/core/dev.c:7569 net/core/dev.c:7696)\n handle_softirqs (kernel/softirq.c:579)\n do_softirq (kernel/softirq.c:480)\n </IRQ>","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ntcp: No llamar a reqsk_fastopen_remove() en tcp_conn_request().\n\nsyzbot informó el 'splat' a continuación en tcp_conn_request(). [0]\n\nSi un 'listener' es cerrado (close()) mientras un socket TFO está siendo procesado en tcp_conn_request(), inet_csk_reqsk_queue_add() no establece reqsk->sk y llama a inet_child_forget(), lo que llama a tcp_disconnect() para el socket TFO.\n\nDespués del 'commit' citado, tcp_disconnect() llama a reqsk_fastopen_remove(), donde se llama a reqsk_put() debido a !reqsk->sk.\n\nLuego, reqsk_fastopen_remove() en tcp_conn_request() decrementa el último req->rsk_refcnt y libera reqsk, y __reqsk_free() en la etiqueta drop_and_free causa el desbordamiento negativo del contador de referencias para el 'listener' y la doble liberación de reqsk.\n\nEliminemos reqsk_fastopen_remove() en tcp_conn_request().\n\nNótese que otros llamadores se aseguran de que tp->fastopen_rsk no sea NULL.\n\n[0]:\nrefcount_t: desbordamiento negativo; uso después de liberación.\nADVERTENCIA: CPU: 12 PID: 5563 en lib/refcount.c:28 refcount_warn_saturate (lib/refcount.c:28)\nMódulos enlazados:\nCPU: 12 UID: 0 PID: 5563 Comm: syz-executor No contaminado syzkaller #0 PREEMPT(full)\nNombre del hardware: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025\nRIP: 0010:refcount_warn_saturate (lib/refcount.c:28)\nCódigo: ab e8 8e b4 98 ff 0f 0b c3 cc cc cc cc cc 80 3d a4 e4 d6 01 00 75 9c c6 05 9b e4 d6 01 01 48 c7 c7 e8 df fb ab e8 6a b4 98 ff <0f> 0b e9 03 5b 76 00 cc 80 3d 7d e4 d6 01 00 0f 85 74 ff ff ff c6\nRSP: 0018:ffffa79fc0304a98 EFLAGS: 00010246\nRAX: d83af4db1c6b3900 RBX: ffff9f65c7a69020 RCX: d83af4db1c6b3900\nRDX: 0000000000000000 RSI: 00000000ffff7fff RDI: ffffffffac78a280\nRBP: 000000009d781b60 R08: 0000000000007fff R09: ffffffffac6ca280\nR10: 0000000000017ffd R11: 0000000000000004 R12: ffff9f65c7b4f100\nR13: ffff9f65c7d23c00 R14: ffff9f65c7d26000 R15: ffff9f65c7a64ef8\nFS: 00007f9f962176c0(0000) GS:ffff9f65fcf00000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000200000000180 CR3: 000000000dbbe006 CR4: 0000000000372ef0\nRastro de llamadas:\n <IRQ>\n tcp_conn_request (./include/linux/refcount.h:400 ./include/linux/refcount.h:432 ./include/linux/refcount.h:450 ./include/net/sock.h:1965 ./include/net/request_sock.h:131 net/ipv4/tcp_input.c:7301)\n tcp_rcv_state_process (net/ipv4/tcp_input.c:6708)\n tcp_v6_do_rcv (net/ipv6/tcp_ipv6.c:1670)\n tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1906)\n ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:438)\n ip6_input (net/ipv6/ip6_input.c:500)\n ipv6_rcv (net/ipv6/ip6_input.c:311)\n __netif_receive_skb (net/core/dev.c:6104)\n process_backlog (net/core/dev.c:6456)\n __napi_poll (net/core/dev.c:7506)\n net_rx_action (net/core/dev.c:7569 net/core/dev.c:7696)\n handle_softirqs (kernel/softirq.c:579)\n do_softirq (kernel/softirq.c:480)\n </IRQ>","source":"nvd"}],"published":"2025-11-12T21:56:29.033Z","modified":"2026-10-19T21:10:00.160Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"7ec092a91ff351dcde89c23e795b73a328274db6","fixed":"e359b742eac1eac75cff4e38ee2e8cea492acd9b","status":"affected"},{"type":"git","introduced":"a4378dedd6e07e62f2fccb17d78c9665718763d0","fixed":"ff6a8883f96a5bc74241ce5b3d431a6dcfa2124d","status":"affected"},{"type":"git","introduced":"33a4fdf0b4a25f8ce65380c3b0136b407ca57609","fixed":"eb85ad5f23268d64b037bfb545cbcba3752f90c7","status":"affected"},{"type":"git","introduced":"17d699727577814198d744d6afe54735c6b54c99","fixed":"643a94b0cf767325e953591c212be2eb826b9d7f","status":"affected"},{"type":"git","introduced":"dfd06131107e7b699ef1e2a24ed2f7d17c917753","fixed":"422c1c173c39bbbae1e0eaaf8aefe40b2596233b","status":"affected"},{"type":"git","introduced":"fa4749c065644af4db496b338452a69a3e5147d9","fixed":"c11ace909e873118295e9eb22dc8c58b0b50eb32","status":"affected"},{"type":"git","introduced":"45c8a6cc2bcd780e634a6ba8e46bffbdf1fc5c01","fixed":"64dc47a13aa3d9daf7cec29b44dca8e22a6aea15","status":"affected"},{"type":"git","introduced":"45c8a6cc2bcd780e634a6ba8e46bffbdf1fc5c01","fixed":"2e7cbbbe3d61c63606994b7ff73c72537afe2e1c","status":"affected"},{"type":"git","version":"ae313d14b45eca7a6bb29cb9bf396d977e7d28fb","status":"affected"},{"type":"semver","introduced":"5.4.300","fixed":"5.4.301","status":"affected"},{"type":"semver","introduced":"5.10.245","fixed":"5.10.246","status":"affected"},{"type":"semver","introduced":"5.15.194","fixed":"5.15.195","status":"affected"},{"type":"semver","introduced":"6.1.154","fixed":"6.1.157","status":"affected"},{"type":"semver","introduced":"6.6.108","fixed":"6.6.113","status":"affected"},{"type":"semver","introduced":"6.12.49","fixed":"6.12.54","status":"affected"},{"type":"semver","introduced":"6.16.9","fixed":"6.17","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.17","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.17","status":"unaffected"},{"type":"semver","introduced":"5.4.301","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.246","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.195","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.157","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.113","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.54","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.4","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/e359b742eac1eac75cff4e38ee2e8cea492acd9b","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ff6a8883f96a5bc74241ce5b3d431a6dcfa2124d","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/eb85ad5f23268d64b037bfb545cbcba3752f90c7","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/643a94b0cf767325e953591c212be2eb826b9d7f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/422c1c173c39bbbae1e0eaaf8aefe40b2596233b","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c11ace909e873118295e9eb22dc8c58b0b50eb32","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/64dc47a13aa3d9daf7cec29b44dca8e22a6aea15","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2e7cbbbe3d61c63606994b7ff73c72537afe2e1c","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-15T21:57:46.472Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40186","url":"https://www.cve.org/CVERecord?id=CVE-2025-40186","licence":"CVE Terms of Use","modified":"2026-10-15T22:02:39.982Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40186","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40186","licence":"Public domain","modified":"2026-10-19T21:10:00.160Z"}],"updatedAt":"2026-11-25T22:59:07.592Z","epss":{"score":0.00585,"percentile":0.49311,"date":"2026-12-01T12:00:22.000Z"}}