CVE-2026-139416: ALSA: rawmidi: Drain input work before freeing the runtime

Published Nov 30, 2026
·
Updated

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

ALSA: rawmidi: Drain input work before freeing the runtime

The input runtime embeds eventwork, so the work must be drained before closesubstream() frees the runtime. The cancellation in sndrawmidiinputtrigger() runs before close clears substream->opened, leaving a window for sndrawmidireceive() to enqueue more work.

With a sequencer subscription to a USB MIDI input port, an in-flight completion can overlap the last subscription's midisynthunsubscribe():

1. sndusbmidiinputdata() observes inputtriggered and is delayed before calling sndrawmidireceive(). 2. Unsubscribe enters closesubstream(), clears inputtriggered through the provider trigger callback and returns from cancelworksync(). The substream is still opened. 3. The completion resumes. sndrawmidireceive() takes substream->lock, sees opened set and queues runtime->eventwork before dropping the lock. 4. Close clears opened under that lock, closes the provider and frees the runtime. Stopping USB URBs does not drain the raw-MIDI work. 5. The queued work runs and sndrawmidiinputeventwork() reads event or substream from the freed runtime, causing a use-after-free.

Cancel input eventwork again after clearing opened, before closing the provider or releasing the runtime's private data. Receive holds substream->lock through its opened check and work enqueue, so once close has cleared opened under that lock, no further receive can queue work. The final cancellation therefore drains any late work before the runtime is freed. Keep it outside the spinlock so a running callback can finish.

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In the Linux kernel ALSA raw-MIDI close path, cancel the input event work again after clearing substream->opened and before closing the provider or freeing the runtime.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:34 PM
Data Sourced
via MITRE·01:34 PM
Description

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