AZL-114371: CVE-2026-99318 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
ALSA: bcd2000: Fix use-after-free of MIDI URBs on file close
bcd2000disconnect() calls sndcarddisconnect(), which only prevents new opens, and then frees the MIDI URBs. A rawmidi file that was already open can still be closed afterwards, and its close callback, bcd2000midioutputclose(), calls usbkillurb() on midiouturb.
The URB pointers are cleared on disconnect and their accesses are serialized with midilock, but bcd2000midioutputclose() reads midiouturb without that lock. The check can therefore pass just before the pointer is cleared, and usbkillurb() then runs on the URB that has already been freed:
BUG: KASAN: slab-use-after-free in usbkillurb+0x74/0x80 Read of size 8 at addr ffff8880078e7d40 usbkillurb bcd2000midioutputclose closesubstream rawmidireleasepriv sndrawmidirelease
Allocated by: usballocurb <- bcd2000initmidi <- bcd2000probe Freed by: usbfreeurb <- bcd2000midifree <- bcd2000disconnect
Take the lock in bcd2000midioutputclose() and reference the URB with usbgeturb() before releasing it. The URB then stays valid until usbputurb() after usbkillurb() has returned, even if a disconnect frees it in the meantime. usbkillurb() itself cannot run under midilock, as the completion handler takes the same lock.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In bcd2000_midi_output_close(), take midi_lock and call usb_get_urb() on midi_out_urb before releasing the lock; call usb_kill_urb() after releasing the lock, then call usb_put_urb() after usb_kill_urb() returns. Serialize access to the URB pointer with midi_lock.