CVE-2026-139098: tcp: avoid double destroy in tcp_abort() of an unaccepted child
In the Linux kernel, the following vulnerability has been resolved:
tcp: avoid double destroy in tcpabort() of an unaccepted child
tcpabort() checks for TCPCLOSE while only owning the socket lock, then grabs the BH lock before calling tcpdonewitherror().
For a child still sitting in a listener accept queue (which can be reached via SOCKDESTROY or bpfsockdestroy()), inetcsklistenstop() can run in this window: it only holds the child BH lock, and calls inetchildforget(), which disconnects, orphans and destroys the child.
tcpabort() then calls tcpdonewitherror() -> tcpdone(), which sees SOCKDEAD and calls inetcskdestroysock() a second time, leading to a double sockput() and a use-after-free.
Recheck TCPCLOSE after acquiring the BH lock, unless we just closed a listener ourselves, in which case tcpdonewitherror() must still run to report the error.
Note that the WARNON(sockownedbyuser(child)) in inetcsklistenstop() can still trigger in this window.
[edumazet: recheck TCPCLOSE under the BH lock instead of moving the test, smaller diff]