{"id":"CVE-2026-142986","summary":"usb: gadget: f_midi: fix UAF race during IN request handling","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_midi: fix UAF race during IN request handling\n\nf_midi_disable() drains and frees pre-allocated IN requests from\nin_req_fifo without holding midi-\u003etransmit_lock. If f_midi_transmit()\nruns concurrently on the workqueue, f_midi_do_transmit() can peek a\nrequest from in_req_fifo and write into its buffer while\nf_midi_disable() frees it, leading to a use-after-free.\n\nAdditionally, when usb_ep_queue() fails in f_midi_do_transmit() (such\nas with -ESHUTDOWN when the endpoint is disabled concurrently), it\nresets req-\u003elength = 0 and returns active instead of the error code,\ncausing the do-while loop in f_midi_transmit() to keep spinning under\nmidi-\u003etransmit_lock until the substream is drained.\n\nFix this by acquiring midi-\u003etransmit_lock in f_midi_disable() while\nreleasing IN requests from in_req_fifo, and returning the error code\nfrom f_midi_do_transmit() when usb_ep_queue() fails so f_midi_transmit()\naborts immediately and drops active substreams.","modified":"2026-12-03T11:00:35.358703970Z","published":"2026-12-03T09:17:17.548Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142986.json","cna_assigner":"Linux"},"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/41b3f72bc94c7701c322fe7c390edd7d2ec1ee38"},{"type":"WEB","url":"https://git.kernel.org/stable/c/78a8d6537f1de34770e460edee360b556ef40427"},{"type":"WEB","url":"https://git.kernel.org/stable/c/bf132239a705c7d3672c3d7086ac911bac23ebf4"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d5e34684b1cdf9635f5c73e1c8ca02c886a81796"},{"type":"WEB","url":"https://git.kernel.org/stable/c/dc15fd316ac860b6904689941bb14527554e8a96"},{"type":"WEB","url":"https://git.kernel.org/stable/c/e43bc0f68b596a20fe7d4b65231e7d27192d5bb5"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/142xxx/CVE-2026-142986.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-142986"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"e1e3d7ec5da32af3bded733a61c248d7db0b4e34"},{"fixed":"e43bc0f68b596a20fe7d4b65231e7d27192d5bb5"},{"fixed":"d5e34684b1cdf9635f5c73e1c8ca02c886a81796"},{"fixed":"bf132239a705c7d3672c3d7086ac911bac23ebf4"},{"fixed":"41b3f72bc94c7701c322fe7c390edd7d2ec1ee38"},{"fixed":"dc15fd316ac860b6904689941bb14527554e8a96"},{"fixed":"78a8d6537f1de34770e460edee360b556ef40427"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-142986.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.5.0"},{"fixed":"5.10.276"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.227"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.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-142986.json"}}],"schema_version":"1.9.2"}