{"id":11282,"date":"2026-09-04T18:53:08","date_gmt":"2026-09-04T10:53:08","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-74714"},"modified":"2026-09-04T18:53:08","modified_gmt":"2026-09-04T10:53:08","slug":"cve-2026-74714","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-74714","title":{"rendered":"CVE-2026-74714 [HIGH] &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: tcp: Fix use-aft"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()<\/p>\n<p>reqsk_queue_hash_req() publishes a TCP_NEW_SYN_RECV request_sock onto<br \/>\nthe ehash chain, drops the bucket lock, and only afterwards sets<br \/>\nrsk_refcnt to 3.<\/p>\n<p>Lockless readers such as __inet_lookup_established() handle this with<br \/>\nrefcount_inc_not_zero(), but bpf_iter_tcp_established_batch() uses plain<br \/>\nsock_hold() while holding the bucket lock, on the assumption that the<br \/>\nlock guarantees sk_refcnt &gt; 0. That assumption does not hold for<br \/>\nrequest_sock:<\/p>\n<p>  CPU 0                                CPU 1<br \/>\n  &#8212;&#8211;                                &#8212;&#8211;<br \/>\n  tcp_conn_request()<br \/>\n   reqsk_queue_hash_req()<br \/>\n    inet_ehash_insert(req)<br \/>\n     spin_lock(bucket)<br \/>\n     __sk_nulls_add_node_rcu(req)      \/\/ rsk_refcnt == 0<br \/>\n     spin_unlock(bucket)<br \/>\n                                       bpf_iter_tcp_established_batch()<br \/>\n                                        spin_lock(bucket)<br \/>\n                                        sock_hold(req)   rsk_refcnt, 3)  \/\/ clobbers saturated value<\/p>\n<p>which surfaces as:<\/p>\n<p>  refcount_t: addition on 0; use-after-free.<br \/>\n  WARNING: lib\/refcount.c:25 at refcount_warn_saturate+0x48\/0x90, CPU#1<br \/>\n  Call Trace:<br \/>\n   bpf_iter_tcp_established_batch+0x14e\/0x170<br \/>\n   bpf_iter_tcp_batch+0x53\/0x200<br \/>\n   bpf_iter_tcp_seq_next+0x27\/0x70<br \/>\n   bpf_seq_read+0x107\/0x410<br \/>\n   vfs_read+0xb9\/0x380<\/p>\n<p>The iterator&#8217;s stolen reference is lost when the publishing CPU&#8217;s<br \/>\nrefcount_set() overwrites the count, leaving the socket one reference<br \/>\nshort. When the last legitimate owner drops its reference the reqsk is<br \/>\nfreed while still reachable, leading to use-after-free.<\/p>\n<p>This reproduces in seconds with tcp_syncookies=0, a handful of threads<br \/>\ndoing connect()\/close() to a local listener while others read an<br \/>\niter\/tcp link in a tight loop.<\/p>\n<p>Use refcount_inc_not_zero() and skip the socket on failure. A skipped<br \/>\nsocket is still part of the bucket, so keep counting it in expected.<br \/>\nThe reallocations are sized from expected, and a request sock whose<br \/>\nrefcount gets published while the lock is held across the last realloc<br \/>\nmust already have room.<\/p>\n<p>A skipped socket is counted in expected but never batched, so end_sk<br \/>\ncan be short of expected on a batch that is actually complete. Decide<br \/>\ncompleteness by whether the walk left any socket behind instead. The<br \/>\nWARN after the locked realloc checks the same, replacing an<br \/>\nend_sk == expected check that could not hold on that path since<br \/>\ncommit cdec67a489d4 (&#8220;bpf: tcp: Make sure iter-&gt;batch always<br \/>\ncontains a full bucket snapshot&#8221;).<\/p>\n<p>If every matching socket in a bucket is mid-init (refcount 0), end_sk<br \/>\nstays 0. Advance to the next bucket rather than returning a batch entry<br \/>\nthat was never filled this round.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()<\/p>\n<p>reqsk_queue_hash_req() publishes a TCP_NEW_SYN_RECV request_sock <\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-11282","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/11282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/vuln"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}