CVE-2026-143395: net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx

Published Dec 3, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

net/9p/usbg: Fix use-after-free on usb9pfscleartx

When p9usbgclose() is called, it invokes usb9pfscleartx() but does not clear usb9pfs->client nor usb9pfs->inreq->context afterwards. The 9p client core (p9clientdestroy) calls close() and then kfree(clnt), so after p9usbgclose returns the client struct is freed.

If the USB gadget is later disabled (e.g., host disconnect), usb9pfsdisable calls usb9pfscleartx again, which passes the dangling usb9pfs->client pointer to p9clientcb. Inside p9clientcb, p9reqput(c, req) dereferences the freed client to access its reqs IDR, causing a use-after-free.

Additionally, usb9pfscleartx does not clear usb9pfs->inreq->context after calling p9clientcb, so a second invocation finds a stale request pointer and attempts double-completion, further compounding the UAF risk.

Fix by: 1. Clearing usb9pfs->inreq->context to NULL in usb9pfscleartx() before checking usb9pfs->client, so that even if the client is gone the stale request pointer is consumed and cannot cause double-completion. 2. Adding a NULL check on usb9pfs->client in usb9pfscleartx() to skip p9clientcb() when the client has already been destroyed. 3. Setting usb9pfs->client = NULL in p9usbgclose() after calling usb9pfscleartx(), to prevent any subsequent call from dereferencing the freed client pointer.

Affected Software

6 affected componentsFixes available
Linux Linux kernel
linux/kernel>=6.12.0<6.12.120
6.12.120
linux/kernel>=6.13.0<6.18.66
6.18.66
linux/kernel>=6.19.0<7.3.7
7.3.7
debian/linux*
debian/linux*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.12.120
  2. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.18.66
  3. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 7.3.7
  4. Compensating control

    In usb9pfs_clear_tx(), check usb9pfs->client for NULL before calling p9_client_cb() and clear usb9pfs->in_req->context to NULL. In p9_usbg_close(), set usb9pfs->client to NULL after clearing TX state so subsequent usb9pfs_clear_tx() calls cannot use a stale client pointer.

Event History

Dec 3, 2026
CVE Published
via MITRE·09:22 AM
Data Sourced
via MITRE·09:22 AM
Description
Data Sourced
via OSV·09:22 AM
DescriptionAffected Software
Data Sourced
via NVD·10:18 AM
Description

Frequently Asked Questions

1

Which deployments are exposed to this condition?

The affected path is the Linux kernel's net/9p/usbg USB 9p filesystem gadget implementation. The condition requires a 9p client to have been closed while the USB gadget can later be disabled.

2

What event can trigger the use-after-free after the client is closed?

Disabling the USB gadget can invoke usb9pfs_clear_tx() again after p9_client_destroy() has freed the client structure. A host disconnect is given as an example of an event that disables the gadget.

3

What does the fix do to prevent repeated cleanup from using stale state?

It clears the in-flight request context before processing the client and checks whether the client pointer is NULL before calling the 9p client callback. This prevents reuse of the stale request context and avoids passing a freed client pointer to the callback.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203