CVE-2026-80850: tcp: fix AO info use-after-free in tcp_ao_connect_init()
In the Linux kernel, the following vulnerability has been resolved:
tcp: fix AO info use-after-free in tcpaoconnectinit()
tcpv4connect() adds a SYN-SENT socket to the ehash before calling tcpconnect(). If TCP-AO is configured, tcpconnect() first verifies that a key matches the peer and the bound device's current L3 master. tcpaoconnectinit() later resolves the L3 master again and removes keys which do not match it.
The socket lock does not stabilize the bound device's VRF membership. Detaching the device from its VRF between the initial validation and the L3-master calculation in tcpaoconnectinit() can therefore make the validation succeed while initialization observes the default L3 domain and removes the only key. The subsequent AO lookup then fails, so the no-key path clears tp->aoinfo and frees it directly.
The receive path can find the socket in the ehash and load tp->aoinfo under RCU before acquiring the socket lock. A reader which loaded the old pointer can thus continue into tcpinboundaohash() after the direct free.
The issue was found during a static audit of TCP-AO object lifetime. An unprivileged reproducer in self-created user and network namespaces raced connect() with detaching a veth from its VRF while sending TCP-AO segments. It triggered the same KASAN report on two fresh boots:
BUG: KASAN: slab-use-after-free in tcpinboundaohash+0x585/0x19f0 Write of size 8 at addr ffff88800bf88128 by task tcpaovrfrace/232
Call Trace: tcpinboundaohash+0x585/0x19f0 tcpinboundhash+0x677/0xa80 tcpv4rcv+0x1c3e/0x3ab0
Allocated by task 235: tcpaoallocinfo+0x43/0xf0 tcpaoaddcmd+0xdf7/0x13b0 dotcpsetsockopt+0x168c/0x2640
Freed by task 235: kfree+0x1b8/0x550 tcpconnect+0x252/0x4f00 tcpv4connect+0x1114/0x1720
The bad address is 40 bytes inside the freed 128-byte object, matching the tcpaoinfo counters.keynotfound field. The two runs used 1000 attempts each, reached the no-key path 366 and 411 times, and produced one and two KASAN reports respectively. With this change, the same reproducer reached the no-key path 366 times in 1000 attempts without a KASAN report or oops.
Use tcpaodestroysock() for the no-key path. It unpublishes the AO info, updates the socket memory and static-key accounting, and defers the free until after an RCU grace period.
Also drop the WARNONONCE() and its stale comment. The VRF detach race makes the no-key state reachable during normal operation, so it is a handled condition rather than an impossible assertion. On paniconwarn kernels the WARN would turn this handled race into a kernel panic.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this race condition?
The affected path requires TCP-AO to be configured. It involves a TCP connection on a socket bound to a device whose VRF/L3-master membership can change during connection setup.
What event must occur for the vulnerable state to be reached?
A TCP-AO key must initially validate against the peer and the bound device's L3 master, then the device must be detached from its VRF before tcp_ao_connect_init() resolves the L3 master again. This can cause the only matching key to be removed and the AO information to be freed while a receive-path reader may still use it.
Is local privilege required to reproduce the issue?
The vulnerability description states that an unprivileged reproducer was created using self-created user and network namespaces. It does not provide further prerequisites or reproduction details.