ALSA: bcd2000: clear the URB pointers on disconnect
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b47a22290d581277be70e8a597824a4985d39e83 · < 7df3194bdb7479cad9199889655a566a2c0c1d1b| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ALSA: bcd2000: clear the URB pointers on disconnect
bcd2000_free_usb_related_resources() frees both URBs and leaves the pointers behind:
usb_kill_urb(bcd2k->midi_out_urb); usb_kill_urb(bcd2k->midi_in_urb);
usb_free_urb(bcd2k->midi_out_urb); usb_free_urb(bcd2k->midi_in_urb);
The rawmidi device outlives that call. A substream that is still open when the device is unplugged reaches bcd2000_midi_send() from the trigger path on close. That function writes to the freed URB and then hands it to the USB core:
bcd2k->midi_out_urb->transfer_buffer_length = BUFSIZE; ... ret = usb_submit_urb(bcd2k->midi_out_urb, GFP_ATOMIC);
usb_kill_urb() does not stop a later submission either, so a submit that races the disconnect can requeue the URB after it has been reaped. midi_in_urb is exposed the same way: bcd2000_input_complete() resubmits it from the completion handler.
From the CVE record · Linux
The Linux kernel’s ALSA bcd2000 driver can access freed USB request blocks after a device is unplugged. A local user with an open rawmidi substream can trigger a use-after-free when closing it after disconnect; a completion handler can also race with disconnect.
Engineers running Linux kernels with the ALSA bcd2000 driver should check their kernel’s status; the issue was observed on 7.2.0-rc5, but the affected version range is not specified.