CVE-2026-143150: tcp: fix request_sock use-after-free during Fast Open accept()
In the Linux kernel, the following vulnerability has been resolved:
tcp: fix requestsock use-after-free during Fast Open accept()
Commit e3d95ad7da4f ("inet: avoid fastopen lock for regular accept()") made inetcskaccept() check tfolistener before taking fastopenq.lock to avoid taking the lock for connections that did not use Fast Open.
reqskfastopenremove() clears tfolistener while holding fastopenq.lock, then reads req->sk. If inetcskaccept() concurrently observes tfolistener after it has been cleared, it skips fastopenq.lock and drops the last reference to the requestsock. This can free the requestsock while reqskfastopenremove() is still using it.
If the freed memory is reused for a new requestsock with req->sk == NULL, the reset path in reqskfastopenremove() can append the new requestsock to the original listener's list of requests that caused an RST. After the new requestsock is freed, the next append writes through the stale rskqrsttail into freed memory.
KASAN reported the following use-after-free when writing fastopenq->rskqrsttail->dlnext = req:
BUG: KASAN: slab-use-after-free in reqskfastopenremove+0x142/0x210 Write of size 8 at addr ffff888108230688 by task swapper/5/0 ... Call Trace: <IRQ> ... reqskfastopenremove+0x142/0x210 tcpcheckreq+0x96f/0xdd0 ... tcprcvstateprocess+0x19c/0x26b0 ... tcpv4dorcv+0x16e/0x490 tcpv4rcv+0x14a0/0x1af0 ... ipprotocoldeliverrcu+0x39/0x1e0 iplocaldeliverfinish+0x124/0x1e0 iplocaldeliver+0xfb/0x1e0 ... </IRQ>
To widen the race windows, mdelay(5) was added after newsk = req->sk, mdelay(20) after the if (req) reqskput(req) block, and mdelay(100) after tcprsk(req)->tfolistener = false. The KASAN report above was reproduced with this kernel.
For the lockless check, use tcpsk(newsk)->synfastopenchild instead of tfolistener, which reqskfastopenremove() clears.
synfastopenchild is a field of the Fast Open child TCP socket referenced by newsk, not of the requestsock. It is set before the child socket is added to the accept queue. The paths that call reqskfastopenremove() in response to a remote ACK or RST do not clear this field.
inetcskaccept() uses this field to take fastopenq.lock only for Fast Open child sockets and rechecks tfolistener while holding the lock. Connections that did not use Fast Open continue to avoid the lock.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.66 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.7 - Compensating control
In inet_csk_accept(), use tcp_sk(newsk)->syn_fastopen_child for the lockless check instead of tfo_listener, then recheck tfo_listener while holding fastopenq.lock.
Event History
Frequently Asked Questions
Which deployments are exposed to this race?
The race involves Linux TCP listeners using TCP Fast Open and concurrent accept and request-removal activity. Regular accepts are relevant because the affected optimization skips the Fast Open queue lock when it observes that the request is no longer marked as having a Fast Open listener.
What is the likely impact if the race occurs?
A request_sock can be freed while reqsk_fastopen_remove() is still accessing it. Subsequent reuse and freeing of request_sock memory can cause writes through a stale rskq_rst_tail pointer into freed memory.
How can an affected system be identified at runtime?
The issue was observed by KASAN as a slab use-after-free write in reqsk_fastopen_remove(), specifically while writing through fastopenq->rskq_rst_tail->dl_next. KASAN reports with that function and write pattern are evidence of this condition.
What remediation is available?
The vulnerability is described as resolved, and stable-kernel fix references are provided for commits b6410a98a09e1d910000dfb045920e94f782443d, 8a8043bb3b7093f92e776a8125be7bd4ad0214d4, and 62754aad50d0b30938bd8ce30b43474ce502a2af.