{"id":"CVE-2026-143292","summary":"tcp: wait for TIME_WAIT teardown before freeing per-netns ehash","details":"In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: wait for TIME_WAIT teardown before freeing per-netns ehash\n\ninet_twsk_kill() removes a TIME_WAIT socket from the established hash\nbefore it finishes using the ehash lock, hashinfo and bind tables, and\nbefore it drops the death-row reference. A running timer can therefore\nunhash its socket before inet_twsk_purge() reaches it. The purge cannot\nsynchronize with that timer, and tcp_sk_exit_batch() can free the\nprivate ehash and hashinfo while inet_twsk_kill() is still using them.\n\nAn unprivileged reproducer using user and network namespaces, a private\nTCP ehash and a FIN_WAIT2 timer triggers a KASAN slab-use-after-free in\ninet_twsk_kill(). The allocation and free stacks point to\ninet_pernet_hashinfo_alloc() and inet_pernet_hashinfo_free().\n\nWait for an RCU grace period after purging the whole batch, if one\nnetns in the batch uses a private ehash. TIME_WAIT removal runs with\nbottom halves disabled, so this also waits for removers that were\nalready invisible to the purge. Keep the wait under\ntcp_exit_batch_mutex, before freeing any private hashinfo.\n\nThe same window exists with the shared tcp_hashinfo. There, the\nhashinfo memory stays valid, but tcp_sk_exit_batch() can decrement\ntcp_death_row.tw_refcount from 2 to 1 before inet_twsk_kill() drops its\nown reference. This triggers the WARN_ON_ONCE() in tcp_sk_exit_batch(),\nthen a refcount_t \"decrement hit 0\" warning from inet_twsk_kill().\n\nAdding a grace period for the shared case would be costly on busy\nhosts. It is not needed: struct net is freed by a later cleanup_net(),\nafter the synchronize_rcu() in ops_undo_list(), so inet_twsk_kill()\ncan safely drop the last tw_refcount reference itself.\nUse refcount_dec_if_one() and only warn if tw_refcount is not 1\nafter a grace period.\n\n[edumazet: only call synchronize_net() if one netns in the batch uses a private ehash,\n use refcount_dec_if_one() to avoid a false WARN with the shared ehash]","modified":"2026-12-03T11:01:55.438076758Z","published":"2026-12-03T09:21:26.953Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143292.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/068877fbd13041f01b9c20687a82c0773158b200"},{"type":"WEB","url":"https://git.kernel.org/stable/c/0a987038ea68d3c14ea905c817855b2e58ace158"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3f4e42618b5c2cbeb4e36a7b7fb1047cced39bce"},{"type":"WEB","url":"https://git.kernel.org/stable/c/647b81ddefc6364290e67bf33c89d54971f8995e"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143292.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143292"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"d1e5e6408b305ff78b825d437df8d3f77e82a4be"},{"fixed":"068877fbd13041f01b9c20687a82c0773158b200"},{"fixed":"3f4e42618b5c2cbeb4e36a7b7fb1047cced39bce"},{"fixed":"0a987038ea68d3c14ea905c817855b2e58ace158"},{"fixed":"647b81ddefc6364290e67bf33c89d54971f8995e"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143292.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.1.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143292.json"}}],"schema_version":"1.9.2"}