CVE-2026-142882: net/9p/usbg: clear stale request context after abort
In the Linux kernel, the following vulnerability has been resolved:
net/9p/usbg: clear stale request context after abort
usb9pfscleartx() serializes access to the active TX request with usb9pfs->lock, but leaves inreq->context pointing at the request after p9clientcb() drops the transport reference. A later teardown path can therefore retrieve the same request after it has been freed:
CPU 0 (p9usbgclose) CPU 1 (usb9pfsdisable) lock(usb9pfs->lock) req = inreq->context p9clientcb(client, req) p9reqput(client, req) unlock(usb9pfs->lock) request reaches zero refs kmemcachefree(req) lock(usb9pfs->lock) req = inreq->context read req->terr
The lock orders the two callbacks, but cannot protect a pointer that remains published after its reference has been released. KASAN reported:
BUG: KASAN: slab-use-after-free in usb9pfscleartx+0x166/0x1b0 Read of size 4 at addr ffff88810e7420f4 by task poc/94 Call Trace: usb9pfscleartx+0x166/0x1b0 usb9pfsdisable+0x1d/0x30 resetconfig+0x9d/0x200 compositedisconnect+0xa7/0x140 Allocated by task 93: kmemcacheallocnoprof+0x141/0x370 p9tagalloc+0x8f/0x5b0 p9clientpreparereq+0xff/0x350 p9clientrpc+0x1a5/0xac0 Freed by task 0: slabfreeafterrcudebug+0xa6/0x1e0 rcucore+0x50a/0x1850 Last potentially related work creation: kmemcachefree+0x1db/0x3d0 p9reqput+0x164/0x1f0 usb9pfscleartx+0x120/0x1b0 p9usbgclose+0x7e/0x150
Clear inreq->context after the callback while still holding the lock. This matches the consume-and-clear pattern in usb9pfstxcomplete(), so subsequent teardown calls return without touching the released request. The existing callback and error ordering remain unchanged.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.118 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Compensating control
In usb9pfs_clear_tx(), clear in_req->context after the callback while still holding usb9pfs->lock, so teardown cannot retrieve a released request.
Event History
Frequently Asked Questions
What conditions are needed to trigger the use-after-free?
The race involves an active USB 9P transmit request being aborted or closed while a USB gadget disable or teardown path runs. The close path can release the request while its pointer remains in in_req->context, and the later disable path can dereference that stale pointer.
Who is most likely exposed to this issue?
Systems using the Linux kernel's net/9p/usbg USB 9P filesystem gadget code are the relevant population. The provided data does not establish whether this configuration is enabled or used by default.
How can an affected system be identified during testing or diagnosis?
KASAN may report a slab use-after-free in usb9pfs_clear_tx, with usb9pfs_disable and USB gadget disconnect or reset paths in the call trace. The report may show a read of req->t_err after the associated 9P request has been freed.
Which kernel versions contain the fix?
The provided information does not list affected or fixed kernel version numbers. It provides three stable kernel commit references for the resolved issue.