CVE-2026-89732: usb: gadget: f_fs: Prevent deadlock during ep0 read loop

Published Sep 11, 2026
·
Updated

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

usb: gadget: ffs: Prevent deadlock during ep0 read loop

Currently, ffsep0read() holds ffs->mutex when it prepares to go to sleep waiting for an event. When no setup events are pending, it calls waiteventinterruptibleexclusivelockedirq() with the mutex still held. The wait macro deliberately drops the waitqueue spinlock before sleeping but does not drop the mutex.

If a userspace daemon is polling ep0 via read() and the gadget is asynchronously torn down via configfs (e.g., echo "" > UDC), a deadlock can occur:

1. The configfs teardown calls functionfsunbind(), which queues a FUNCTIONFSUNBIND event. 2. The daemon wakes up, consumes the event, and drops the mutex. 3. However, if the daemon loops and immediately issues another read() before exiting, it reacquires ffs->mutex and again goes into an interruptible sleep. 4. Meanwhile, functionfsunbind() continues execution and attempts to acquire ffs->mutex to tear down ep0req. 5. The kernel deadlocks because the configfs thread is stuck in an uninterruptible sleep waiting for the mutex, while the userspace daemon is in an interruptible sleep holding the mutex forever because no more events will arrive.

To fix this, we drop both the waitqueue spinlock and ffs->mutex before going to sleep, and use waiteventinterruptibleexclusive() instead. Upon waking up, we jump back to the retry label to safely reacquire the mutex and re-evaluate the state machine. By not sleeping with ffs->mutex held, we natively decouple gadget teardowns (which require the mutex) from userspace polling.

Event History

Sep 11, 2026
CVE Published
via MITRE·07:46 PM
Data Sourced
via MITRE·07:46 PM
Description

Frequently Asked Questions

1

What systems are exposed to this deadlock?

Systems using the Linux USB gadget FunctionFS implementation are exposed when a userspace daemon polls the ep0 endpoint with read() while the gadget is asynchronously torn down through configfs, such as by unbinding the UDC.

2

What conditions are required to trigger the issue?

A FunctionFS userspace daemon must consume a FUNCTIONFS_UNBIND event and then immediately issue another ep0 read() before exiting. At the same time, functionfs_unbind() must be continuing teardown and attempting to acquire the same ffs->mutex.

3

What is the operational impact if it occurs?

The configfs teardown thread can become stuck in uninterruptible sleep waiting for ffs->mutex, while the userspace daemon sleeps interruptibly holding that mutex. This deadlocks gadget teardown and ep0 request cleanup.

4

What can be done before applying the fix?

Avoid asynchronously unbinding the USB gadget while a FunctionFS daemon is actively polling ep0. Ensure the daemon stops issuing ep0 read() calls and exits after receiving the unbind event before initiating or continuing teardown.

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