{"id":4874,"date":"2026-09-04T18:46:50","date_gmt":"2026-09-04T10:46:50","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-64584"},"modified":"2026-09-04T18:46:50","modified_gmt":"2026-09-04T10:46:50","slug":"cve-2026-64584","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-64584","title":{"rendered":"CVE-2026-64584 [HIGH] &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_midi:"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>usb: gadget: f_midi: cancel pending IN work before freeing the midi object<\/p>\n<p>The f_midi driver embeds a work item (midi-&gt;work) whose handler,<br \/>\nf_midi_in_work(), dereferences the enclosing struct f_midi through<br \/>\ncontainer_of().  This work is armed from two sites: f_midi_complete(),<br \/>\non a normal IN-endpoint completion, and f_midi_in_trigger(), on an ALSA<br \/>\nrawmidi output-stream start.<\/p>\n<p>Neither f_midi_disable() nor f_midi_unbind() cancels midi-&gt;work.<br \/>\nf_midi_disable() only disables the endpoints and drains the in_req_fifo;<br \/>\nit does not synchronize the work item, and the sound card is released<br \/>\nasynchronously to the final free of the midi object.<\/p>\n<p>The midi object is reference-counted (midi-&gt;free_ref) and is freed in<br \/>\nf_midi_free() only once both the usb_function reference and the rawmidi<br \/>\nprivate_data reference have been dropped.  In f_midi_unbind(),<br \/>\nf_midi_disable() runs before the sound card is released, so while the<br \/>\nUSB endpoints are already disabled the rawmidi device is still usable by<br \/>\nan open substream.  A concurrent userspace write on such a substream can<br \/>\nreach f_midi_in_trigger() and queue midi-&gt;work again after<br \/>\nf_midi_disable() has returned.  A work item armed this way may still be<br \/>\npending when the last reference drops and f_midi_free() proceeds to<br \/>\nkfree(midi), letting f_midi_in_work() dereference the struct after it<br \/>\nhas been freed, a use-after-free.<\/p>\n<p>For this reason cancelling midi-&gt;work in f_midi_disable() would not be<br \/>\nsufficient: the ALSA trigger path can rearm the work after disable()<br \/>\nreturns.  Cancelling at the refcount-zero free site is the boundary<br \/>\nafter which neither arming source can survive, because by then both<br \/>\nreferences that keep the midi object alive have been dropped: the USB<br \/>\nendpoints are already disabled and the rawmidi device has been released.<\/p>\n<p>Fix this by calling cancel_work_sync(&amp;midi-&gt;work) in the refcount-zero<br \/>\nblock of f_midi_free(), before the embedded work_struct is freed along<br \/>\nwith the rest of the structure.  opts-&gt;lock is a sleeping mutex, so<br \/>\ncalling cancel_work_sync() under it is permitted, and the handler takes<br \/>\nmidi-&gt;transmit_lock rather than opts-&gt;lock, so no self-deadlock can<br \/>\noccur while it waits for a running instance of the work to finish.<\/p>\n<p>This issue was found by an in-house static analysis tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>usb: gadget: f_midi: cancel pending IN work before freeing the midi object<\/p>\n<p>The f_midi driver embeds a work item (midi-&gt;work) whose<\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-4874","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/4874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/vuln"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}