Skip to content
Medium 4.7

ALSA: rawmidi: Drain input work before freeing the runtime

CVE-2026-139416 First seen on SecPulse

Affected packages

PackageAffected → Fixed
LinuxLinux —
LinuxKernel
≥ 3.1.0, < 5.10.275→ 5.10.275
≥ 5.11.0, < 5.15.226→ 5.15.226
≥ 5.16.0, < 6.6.163→ 6.6.163
≥ 6.7.0, < 6.12.119→ 6.12.119
≥ 6.13.0, < 6.18.65→ 6.18.65
≥ 6.19.0, < 7.3.6→ 7.3.6

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

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

ALSA: rawmidi: Drain input work before freeing the runtime

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

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

  1. snd_usbmidi_input_data() observes input_triggered and is delayed
    before calling snd_rawmidi_receive().
  2. Unsubscribe enters close_substream(), clears input_triggered through
    the provider trigger callback and returns from cancel_work_sync().
    The substream is still opened.
  3. The completion resumes. snd_rawmidi_receive() takes substream->lock,
    sees opened set and queues runtime->event_work 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 snd_rawmidi_input_event_work() reads event
    or substream from the freed runtime, causing a use-after-free.

Cancel input event_work 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 fu…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details