{"id":"CVE-2026-143395","summary":"net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/9p/usbg: Fix use-after-free on usb9pfs_clear_tx\n\nWhen p9_usbg_close() is called, it invokes usb9pfs_clear_tx() but does\nnot clear usb9pfs-\u003eclient nor usb9pfs-\u003ein_req-\u003econtext afterwards.\nThe 9p client core (p9_client_destroy) calls close() and then\nkfree(clnt), so after p9_usbg_close returns the client struct is freed.\n\nIf the USB gadget is later disabled (e.g., host disconnect),\nusb9pfs_disable calls usb9pfs_clear_tx again, which passes the dangling\nusb9pfs-\u003eclient pointer to p9_client_cb. Inside p9_client_cb,\np9_req_put(c, req) dereferences the freed client to access its reqs IDR,\ncausing a use-after-free.\n\nAdditionally, usb9pfs_clear_tx does not clear usb9pfs-\u003ein_req-\u003econtext\nafter calling p9_client_cb, so a second invocation finds a stale request\npointer and attempts double-completion, further compounding the UAF risk.\n\nFix by:\n1. Clearing usb9pfs-\u003ein_req-\u003econtext to NULL in usb9pfs_clear_tx()\n   before checking usb9pfs-\u003eclient, so that even if the client is gone\n   the stale request pointer is consumed and cannot cause\n   double-completion.\n2. Adding a NULL check on usb9pfs-\u003eclient in usb9pfs_clear_tx() to skip\n   p9_client_cb() when the client has already been destroyed.\n3. Setting usb9pfs-\u003eclient = NULL in p9_usbg_close() after calling\n   usb9pfs_clear_tx(), to prevent any subsequent call from dereferencing\n   the freed client pointer.","modified":"2026-12-03T11:02:12.325857186Z","published":"2026-12-03T09:22:36.772Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143395.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5c69297356bf6d04d8222f52717c6c4aa73e5d2c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/6c7901b8667af551f5efe90d67a6f3f6add0c27b"},{"type":"WEB","url":"https://git.kernel.org/stable/c/840ae53432e569266879dddcaf06993ec2276ec8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/e9c79d83affb05663925d81c83e334bf8d230191"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143395.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143395"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"a3be076dc174d9022a71a12554feb4c97b5c4d5c"},{"fixed":"e9c79d83affb05663925d81c83e334bf8d230191"},{"fixed":"6c7901b8667af551f5efe90d67a6f3f6add0c27b"},{"fixed":"840ae53432e569266879dddcaf06993ec2276ec8"},{"fixed":"5c69297356bf6d04d8222f52717c6c4aa73e5d2c"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143395.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.12.0"},{"fixed":"6.12.120"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.66"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143395.json"}}],"schema_version":"1.9.2"}