CVE-2026-98300: tcp: Don't call skb_clone_and_charge_r() for close()d listener in tcp_v6_do_rcv().
In the Linux kernel, the following vulnerability has been resolved:
tcp: Don't call skbcloneandcharger() for close()d listener in tcpv6dorcv().
tcpv6dorcv() no longer calls skbcloneandcharger() for TCPLISTEN since commit 073d89808c06 ("net: fix data-races around sk->skforwardalloc").
However, there is still a small race window between tcpv6rcv() and tcpv6dorcv(), where concurrent close() changes TCPLISTEN to TCPCLOSE, causing skbcloneandcharger() to be called locklessly and resulting in the splat below. [0]
Let's avoid calling skbcloneandcharger() for TCPCLOSE as well.
This is fine for non-listeners because tcprcvstateprocess() drops skb for TCPCLOSE and optskb was freed immediately anyway.
[0]: sk->skforwardalloc WARNING: net/ipv4/afinet.c:162 at inetsockdestruct+0x64d/0x810 net/ipv4/afinet.c:162, CPU#1: ksoftirqd/1/28 Modules linked in: CPU: 1 UID: 0 PID: 28 Comm: ksoftirqd/1 Not tainted 7.2.0 #17 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.17.0-debian-1.17.0-1 04/01/2014 RIP: 0010:inetsockdestruct+0x64d/0x810 net/ipv4/afinet.c:162 Code: 3d 49 ff e9 06 fd ff ff e8 d0 5b 83 f8 90 0f 0b 90 e9 35 fe ff ff e8 c2 5b 83 f8 90 0f 0b 90 e9 c5 fe ff ff e8 b4 5b 83 f8 90 <0f> 0b 90 e9 04 ff ff ff e8 a6 5b 83 f8 90 0f 0b 90 e9 65 fe ff ff RSP: 0018:ffffc90000677bb8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8880117bde80 RCX: ffffffff8957eb41 RDX: ffff88801dad5d00 RSI: ffffffff8957ec3c RDI: 0000000000000005 RBP: 00000000fffff000 R08: ffffffff8957eb41 R09: 00000000fffff000 R10: 0000000000000005 R11: 0000000000000000 R12: dffffc0000000000 R13: ffff8880117bdf10 R14: ffffffff81c08eb7 R15: 0000000000000003 FS: 0000000000000000(0000) GS:ffff8880d7ae5000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f93a1021138 CR3: 00000000207a9000 CR4: 0000000000350ef0 Call Trace: <TASK> skdestruct+0x82/0xae0 net/core/sock.c:2356 rcudobatch kernel/rcu/tree.c:2645 [inline] rcucore+0x59c/0x1100 kernel/rcu/tree.c:2897 handlesoftirqs+0x1e4/0x9b0 kernel/softirq.c:622 runksoftirqd kernel/softirq.c:1076 [inline] runksoftirqd+0x38/0x60 kernel/softirq.c:1068 smpbootthreadfn+0x458/0xc80 kernel/smpboot.c:160 kthread+0x396/0x4a0 kernel/kthread.c:436 retfromfork+0x8e0/0xe40 arch/x86/kernel/process.c:158 retfromforkasm+0x1a/0x30 arch/x86/entry/entry64.S:245 </TASK>