{"id":"CVE-2026-89732","summary":"usb: gadget: f_fs: Prevent deadlock during ep0 read loop","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_fs: Prevent deadlock during ep0 read loop\n\nCurrently, ffs_ep0_read() holds ffs-\u003emutex when it prepares to go to\nsleep waiting for an event. When no setup events are pending, it calls\nwait_event_interruptible_exclusive_locked_irq() with the mutex still\nheld. The wait macro deliberately drops the waitqueue spinlock before\nsleeping but does not drop the mutex.\n\nIf a userspace daemon is polling ep0 via read() and the gadget is\nasynchronously torn down via configfs (e.g., echo \"\" \u003e UDC), a\ndeadlock can occur:\n\n1. The configfs teardown calls functionfs_unbind(), which queues a\n   FUNCTIONFS_UNBIND event.\n2. The daemon wakes up, consumes the event, and drops the mutex.\n3. However, if the daemon loops and immediately issues another read()\n   before exiting, it reacquires ffs-\u003emutex and again goes into an\n   interruptible sleep.\n4. Meanwhile, functionfs_unbind() continues execution and attempts to\n   acquire ffs-\u003emutex to tear down ep0req.\n5. The kernel deadlocks because the configfs thread is stuck in an\n   uninterruptible sleep waiting for the mutex, while the userspace\n   daemon is in an interruptible sleep holding the mutex forever\n   because no more events will arrive.\n\nTo fix this, we drop both the waitqueue spinlock and ffs-\u003emutex before\ngoing to sleep, and use wait_event_interruptible_exclusive() instead.\nUpon waking up, we jump back to the `retry` label to safely reacquire\nthe mutex and re-evaluate the state machine. By not sleeping with\nffs-\u003emutex held, we natively decouple gadget teardowns (which require\nthe mutex) from userspace polling.","modified":"2026-09-13T03:47:20.762291194Z","published":"2026-09-11T19:46:41.974Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/89xxx/CVE-2026-89732.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/34e88f53614640b59039a46717fb6142e9871022"},{"type":"WEB","url":"https://git.kernel.org/stable/c/569dd7e5dcffe1e1c6b26ca2cd3be57eb433e082"},{"type":"WEB","url":"https://git.kernel.org/stable/c/eac233e63f9db82ba874e3cccafaafab162999e0"},{"type":"WEB","url":"https://git.kernel.org/stable/c/fd20cc68bbdb5620696ac108e8f2efd180fe2c1a"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/89xxx/CVE-2026-89732.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-89732"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"ddf8abd2599491cbad959c700b90ba72a5dce8d0"},{"fixed":"fd20cc68bbdb5620696ac108e8f2efd180fe2c1a"},{"fixed":"34e88f53614640b59039a46717fb6142e9871022"},{"fixed":"eac233e63f9db82ba874e3cccafaafab162999e0"},{"fixed":"569dd7e5dcffe1e1c6b26ca2cd3be57eb433e082"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-89732.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.35"},{"fixed":"6.12.109"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.50"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.2.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-89732.json"}}],"schema_version":"1.9.0"}