usb: gadget: f_midi: fix UAF race during IN request handling
- CVE-2026-142986
- GHSA-hw35-q9vv-p2gp
- EUVD-2026-142602
Description
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_midi: fix UAF race during IN request handling f_midi_disable() drains and frees pre-allocated IN requests from in_req_fifo without holding midi->transmit_lock. If f_midi_transmit() runs concurrently on the workqueue, f_midi_do_transmit() can peek a request from in_req_fifo and write into its buffer while f_midi_disable() frees it, leading to a use-after-free. Additionally, when usb_ep_queue() fails in f_midi_do_transmit() (such as with -ESHUTDOWN when the endpoint is disabled concurrently), it resets req->length = 0 and returns active instead of the error code, causing the do-while loop in f_midi_transmit() to keep spinning under midi->transmit_lock until the substream is drained. Fix this by acquiring midi->transmit_lock in f_midi_disable() while releasing IN requests from in_req_fifo, and returning the error code from f_midi_do_transmit() when usb_ep_queue() fails so f_midi_transmit() aborts immediately and drops active substreams.
Text from the CVE.org record.
Recommendation
No source states a fixed version. Check the vendor advisory.
Affected
Linux
Affected versions Fixed in 4.5 none stated before 4.5: not affected none stated from 5.10.276 up to 5.10.*: not affected none stated from 5.15.227 up to 5.15.*: not affected none stated from 6.12.120 up to 6.12.*: not affected none stated from 6.18.66 up to 6.18.*: not affected none stated from 7.3.7 up to 7.3.*: not affected none stated from 7.4-rc4 onwards: not affected none stated
Product versions from the CVE.org record.
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.