linux/sound/usb
Takashi Iwai 71319db6f3 ALSA: usb-audio: Fix race against the error recovery URB submission
commit 9b7e5208a9 upstream.

USB MIDI driver has an error recovery mechanism to resubmit the URB in
the delayed timer handler, and this may race with the standard start /
stop operations.  Although both start and stop operations themselves
don't race with each other due to the umidi->mutex protection, but
this isn't applied to the timer handler.

For fixing this potential race, the following changes are applied:

- Since the timer handler can't use the mutex, we apply the
  umidi->disc_lock protection at each input stream URB submission;
  this also needs to change the GFP flag to GFP_ATOMIC
- Add a check of the URB refcount and skip if already submitted
- Move the timer cancel call at disconnection to the beginning of the
  procedure; this assures the in-flight timer handler is gone properly
  before killing all pending URBs

Reported-by: syzbot+0f4ecfe6a2c322c81728@syzkaller.appspotmail.com
Reported-by: syzbot+5f1d24c49c1d2c427497@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200710160656.16819-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-22 09:33:09 +02:00
..
6fire
bcd2000
caiaq
hiface
line6 ALSA: line6: Sync the pending work cancel at disconnection 2020-07-22 09:33:08 +02:00
misc
usx2y ALSA: usx2y: Fix potential NULL dereference 2020-04-29 16:33:15 +02:00
Kconfig
Makefile
card.c ALSA: usb-audio: Rewrite registration quirk handling 2020-07-22 09:32:59 +02:00
card.h Revert "ALSA: usb-audio: Improve frames size computation" 2020-07-09 09:37:55 +02:00
clock.c ALSA: usb-audio: Add support for MOTU MicroBook IIc 2020-07-22 09:32:58 +02:00
clock.h ALSA: usb-audio: Add clock validity quirk for Denon MC7000/MCX8000 2020-02-19 19:52:57 +01:00
debug.h
endpoint.c Revert "ALSA: usb-audio: Improve frames size computation" 2020-07-09 09:37:55 +02:00
endpoint.h Revert "ALSA: usb-audio: Improve frames size computation" 2020-07-09 09:37:55 +02:00
format.c ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices 2020-04-29 16:33:16 +02:00
format.h
helper.c
helper.h
media.c
media.h
midi.c ALSA: usb-audio: Fix race against the error recovery URB submission 2020-07-22 09:33:09 +02:00
midi.h
mixer.c ALSA: usb-audio: Fix OOB access of mixer element list 2020-06-30 15:36:50 -04:00
mixer.h ALSA: usb-audio: Fix OOB access of mixer element list 2020-06-30 15:36:50 -04:00
mixer_maps.c ALSA: usb-audio: Quirks for Gigabyte TRX40 Aorus Master onboard audio 2020-06-03 08:21:24 +02:00
mixer_quirks.c ALSA: usb-audio: Fix OOB access of mixer element list 2020-06-30 15:36:50 -04:00
mixer_quirks.h
mixer_scarlett.c
mixer_scarlett.h
mixer_scarlett_gen2.c
mixer_scarlett_gen2.h
mixer_us16x08.c
mixer_us16x08.h
pcm.c ALSA: usb-audio: Add support for MOTU MicroBook IIc 2020-07-22 09:32:58 +02:00
pcm.h
power.c
power.h
proc.c
proc.h
quirks-table.h ALSA: usb-audio: Add quirk for Focusrite Scarlett 2i2 2020-07-22 09:32:59 +02:00
quirks.c ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Flight S 2020-07-22 09:33:00 +02:00
quirks.h ALSA: usb-audio: Rewrite registration quirk handling 2020-07-22 09:32:59 +02:00
stream.c
stream.h
usbaudio.h ALSA: usb-audio: Fix inconsistent card PM state after resume 2020-06-17 16:40:27 +02:00
validate.c