{"id":"CVE-2026-143395","state":"PUBLISHED","title":"net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx","description":"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->client nor usb9pfs->in_req->context 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->client 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->in_req->context\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->in_req->context to NULL in usb9pfs_clear_tx()\n   before checking usb9pfs->client, 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->client in usb9pfs_clear_tx() to skip\n   p9_client_cb() when the client has already been destroyed.\n3. Setting usb9pfs->client = NULL in p9_usbg_close() after calling\n   usb9pfs_clear_tx(), to prevent any subsequent call from dereferencing\n   the freed client pointer.","publishedAt":"2026-12-03T09:22:36.772Z","updatedAt":"2026-12-03T09:22:36.772Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"e9c79d83affb05663925d81c83e334bf8d230191","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"6c7901b8667af551f5efe90d67a6f3f6add0c27b","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"840ae53432e569266879dddcaf06993ec2276ec8","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"5c69297356bf6d04d8222f52717c6c4aa73e5d2c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/9p/trans_usbg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc2","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/9p/trans_usbg.c"]}],"references":["https://git.kernel.org/stable/c/e9c79d83affb05663925d81c83e334bf8d230191","https://git.kernel.org/stable/c/6c7901b8667af551f5efe90d67a6f3f6add0c27b","https://git.kernel.org/stable/c/840ae53432e569266879dddcaf06993ec2276ec8","https://git.kernel.org/stable/c/5c69297356bf6d04d8222f52717c6c4aa73e5d2c"],"weaknesses":[],"ingestedAt":"2026-12-03T09:44:04.436Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143395.json","commit":"9e309c7c0f08856e2558a1df33f75dca027fab70","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143395","state":"PUBLISHED","datePublished":"2026-12-03T09:22:36.772Z","dateUpdated":"2026-12-03T09:22:36.772Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.373Z"},"containers":{"cna":{"title":"net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx","descriptions":[{"lang":"en","value":"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->client nor usb9pfs->in_req->context 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->client 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->in_req->context\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->in_req->context to NULL in usb9pfs_clear_tx()\n   before checking usb9pfs->client, 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->client in usb9pfs_clear_tx() to skip\n   p9_client_cb() when the client has already been destroyed.\n3. Setting usb9pfs->client = NULL in p9_usbg_close() after calling\n   usb9pfs_clear_tx(), to prevent any subsequent call from dereferencing\n   the freed client pointer."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"e9c79d83affb05663925d81c83e334bf8d230191","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"6c7901b8667af551f5efe90d67a6f3f6add0c27b","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"840ae53432e569266879dddcaf06993ec2276ec8","versionType":"git"},{"version":"a3be076dc174d9022a71a12554feb4c97b5c4d5c","status":"affected","lessThan":"5c69297356bf6d04d8222f52717c6c4aa73e5d2c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/9p/trans_usbg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc2","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/9p/trans_usbg.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/e9c79d83affb05663925d81c83e334bf8d230191"},{"url":"https://git.kernel.org/stable/c/6c7901b8667af551f5efe90d67a6f3f6add0c27b"},{"url":"https://git.kernel.org/stable/c/840ae53432e569266879dddcaf06993ec2276ec8"},{"url":"https://git.kernel.org/stable/c/5c69297356bf6d04d8222f52717c6c4aa73e5d2c"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:22:36.772Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"7.4-rc2"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}