{"id":"CVE-2026-98646","state":"PUBLISHED","title":"tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context\n\nbpf_sock_destroy() runs from the tcp iterator, under rcu_read_lock(). If\nthe sock is a listener that still has children in its accept queue,\ntcp_abort() ends up in inet_csk_listen_stop() and the cond_resched()\nthere trips the debug check:\n\nBUG: sleeping function called from invalid context at net/ipv4/inet_connection_sock.c:1523\nin_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 628, name: test_progs\npreempt_count: 0, expected: 0\nRCU nest depth: 1, expected: 0\nlocks held by test_progs/628: 3, last CPU#3:\n #0: ffff8881158cee18 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x56/0x1210\n #1: ffff8881106bb858 (sk_lock-AF_INET6){+.+.}-{0:0}, at: bpf_iter_tcp_seq_show+0x32b/0x4b0\n #2: ffffffffb435af20 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x46b/0xde0\nCPU: 3 UID: 0 PID: 628 Comm: test_progs Tainted: G        W           7.2.0+ #65 PREEMPT\nTainted: [W]=WARN\nCall Trace:\n <TASK>\n dump_stack_lvl+0xc1/0xf0\n dump_stack+0x10/0x20\n __might_resched+0x3d2/0x610\n inet_csk_listen_stop+0x7b/0xbf0\n tcp_abort+0x23b/0x3b0\n bpf_sock_destroy+0xfc/0x140\n bpf_prog_448133d24601754f_iter_tcp6_server+0x81/0x8a\n bpf_iter_run_prog+0x538/0xde0\n bpf_iter_tcp_seq_show+0x26b/0x4b0\n bpf_seq_read+0x424/0x1210\n vfs_read+0x197/0xe40\n ksys_read+0x119/0x240\n __x64_sys_read+0x72/0xc0\n x64_sys_call+0x647/0x27e0\n do_syscall_64+0xe5/0x610\n entry_SYSCALL_64_after_hwframe+0x76/0x7e\nRIP: 0033:0x7fad39b28aca\nRSP: 002b:00007ffc381c61c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000\nRAX: ffffffffffffffda RBX: 00007ffc381c6a88 RCX: 00007fad39b28aca\nRDX: 0000000000000032 RSI: 00007ffc381c6250 RDI: 0000000000000014\nRBP: 00007ffc381c61e0 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003\nR13: 0000000000000000 R14: 000055f077c1bbb0 R15: 00007fad3a0f3000\n </TASK>\n\nThe commit that added the kfunc already guards lock_sock() in tcp_abort()\nand udp_abort() with has_current_bpf_ctx(), but missed the listener path.\nDo the same for the cond_resched(). The loop runs inside the iterator's\nrcu_read_lock(), it must not reschedule or report a quiescent state there.","publishedAt":"2026-10-18T15:20:17.490Z","updatedAt":"2026-10-19T09:23:15.900Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"23da88d1597ee7fdda373e1530284b763710911f","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"5b52417c6196e05618a3b5d9753dbed9adef0166","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"55bbebf2829c3f47c5a48fc261740301d0f25f48","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"ee7246bccb9da66076dd8094daa48bdc761d6b76","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"eaab8cab451b9502ce224cd202550375b894a467","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/ipv4/inet_connection_sock.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.5","versionType":"semver"},{"version":"6.6.158","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.112","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.55","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.2.9","status":"unaffected","lessThanOrEqual":"7.2.*","versionType":"semver"},{"version":"7.3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/ipv4/inet_connection_sock.c"]}],"references":["https://git.kernel.org/stable/c/23da88d1597ee7fdda373e1530284b763710911f","https://git.kernel.org/stable/c/5b52417c6196e05618a3b5d9753dbed9adef0166","https://git.kernel.org/stable/c/55bbebf2829c3f47c5a48fc261740301d0f25f48","https://git.kernel.org/stable/c/ee7246bccb9da66076dd8094daa48bdc761d6b76","https://git.kernel.org/stable/c/eaab8cab451b9502ce224cd202550375b894a467"],"weaknesses":[],"ingestedAt":"2026-10-29T20:13:43.249Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/98xxx/CVE-2026-98646.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-98646","state":"PUBLISHED","datePublished":"2026-10-18T15:20:17.490Z","dateUpdated":"2026-10-19T09:23:15.900Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.362Z"},"containers":{"cna":{"title":"tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context\n\nbpf_sock_destroy() runs from the tcp iterator, under rcu_read_lock(). If\nthe sock is a listener that still has children in its accept queue,\ntcp_abort() ends up in inet_csk_listen_stop() and the cond_resched()\nthere trips the debug check:\n\nBUG: sleeping function called from invalid context at net/ipv4/inet_connection_sock.c:1523\nin_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 628, name: test_progs\npreempt_count: 0, expected: 0\nRCU nest depth: 1, expected: 0\nlocks held by test_progs/628: 3, last CPU#3:\n #0: ffff8881158cee18 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x56/0x1210\n #1: ffff8881106bb858 (sk_lock-AF_INET6){+.+.}-{0:0}, at: bpf_iter_tcp_seq_show+0x32b/0x4b0\n #2: ffffffffb435af20 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x46b/0xde0\nCPU: 3 UID: 0 PID: 628 Comm: test_progs Tainted: G        W           7.2.0+ #65 PREEMPT\nTainted: [W]=WARN\nCall Trace:\n <TASK>\n dump_stack_lvl+0xc1/0xf0\n dump_stack+0x10/0x20\n __might_resched+0x3d2/0x610\n inet_csk_listen_stop+0x7b/0xbf0\n tcp_abort+0x23b/0x3b0\n bpf_sock_destroy+0xfc/0x140\n bpf_prog_448133d24601754f_iter_tcp6_server+0x81/0x8a\n bpf_iter_run_prog+0x538/0xde0\n bpf_iter_tcp_seq_show+0x26b/0x4b0\n bpf_seq_read+0x424/0x1210\n vfs_read+0x197/0xe40\n ksys_read+0x119/0x240\n __x64_sys_read+0x72/0xc0\n x64_sys_call+0x647/0x27e0\n do_syscall_64+0xe5/0x610\n entry_SYSCALL_64_after_hwframe+0x76/0x7e\nRIP: 0033:0x7fad39b28aca\nRSP: 002b:00007ffc381c61c0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000\nRAX: ffffffffffffffda RBX: 00007ffc381c6a88 RCX: 00007fad39b28aca\nRDX: 0000000000000032 RSI: 00007ffc381c6250 RDI: 0000000000000014\nRBP: 00007ffc381c61e0 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003\nR13: 0000000000000000 R14: 000055f077c1bbb0 R15: 00007fad3a0f3000\n </TASK>\n\nThe commit that added the kfunc already guards lock_sock() in tcp_abort()\nand udp_abort() with has_current_bpf_ctx(), but missed the listener path.\nDo the same for the cond_resched(). The loop runs inside the iterator's\nrcu_read_lock(), it must not reschedule or report a quiescent state there."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"23da88d1597ee7fdda373e1530284b763710911f","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"5b52417c6196e05618a3b5d9753dbed9adef0166","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"55bbebf2829c3f47c5a48fc261740301d0f25f48","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"ee7246bccb9da66076dd8094daa48bdc761d6b76","versionType":"git"},{"version":"4ddbcb886268af8d12a23e6640b39d1d9c652b1b","status":"affected","lessThan":"eaab8cab451b9502ce224cd202550375b894a467","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/ipv4/inet_connection_sock.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.5","versionType":"semver"},{"version":"6.6.158","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.112","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.55","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.2.9","status":"unaffected","lessThanOrEqual":"7.2.*","versionType":"semver"},{"version":"7.3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/ipv4/inet_connection_sock.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/23da88d1597ee7fdda373e1530284b763710911f"},{"url":"https://git.kernel.org/stable/c/5b52417c6196e05618a3b5d9753dbed9adef0166"},{"url":"https://git.kernel.org/stable/c/55bbebf2829c3f47c5a48fc261740301d0f25f48"},{"url":"https://git.kernel.org/stable/c/ee7246bccb9da66076dd8094daa48bdc761d6b76"},{"url":"https://git.kernel.org/stable/c/eaab8cab451b9502ce224cd202550375b894a467"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-19T09:23:15.900Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.5","versionEndExcluding":"6.6.158"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.5","versionEndExcluding":"6.12.112"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.5","versionEndExcluding":"6.18.55"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.5","versionEndExcluding":"7.2.9"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.5","versionEndExcluding":"7.3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}