linux-stable-rt/sound/usb
Takashi Iwai 382225e62b ALSA: usb-audio: fix oops due to cleanup race when disconnecting
When a USB audio device is disconnected, snd_usb_audio_disconnect()
kills all audio URBs.  At the same time, the application, after being
notified of the disconnection, might close the device, in which case
ALSA calls the .hw_free callback, which should free the URBs too.

Commit de1b8b93a0 "[ALSA] Fix hang-up at disconnection of usb-audio"
prevented snd_usb_hw_free() from freeing the URBs to avoid a hang that
resulted from this race, but this introduced another race because the
URB callbacks could now be executed after snd_usb_hw_free() has
returned, and try to access already freed data.

Fix the first race by introducing a mutex to serialize the disconnect
callback and all PCM callbacks that manage URBs (hw_free and hw_params).

Reported-and-tested-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: <stable@kernel.org>
[CL: also serialize hw_params callback]
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-02-23 08:15:43 +01:00
..
caiaq ALSA: caiaq - Fix possible string-buffer overflow 2011-02-14 22:50:46 +01:00
misc
usx2y ALSA: snd-usb-us122l: Fix missing NULL checks 2011-01-11 19:50:28 +01:00
Kconfig ALSA: snd-usb-caiaq: Add support for Traktor Kontrol S4 2010-09-10 11:08:39 +02:00
Makefile
card.c ALSA: usb-audio: fix oops due to cleanup race when disconnecting 2011-02-23 08:15:43 +01:00
card.h ALSA: usb-audio: automatically detect feedback format 2010-10-27 09:17:41 +02:00
clock.c ALSA: usb-audio: fix detection of vendor-specific device protocol settings 2010-09-03 22:36:39 +02:00
clock.h
debug.h
endpoint.c Merge branch 'fix/misc' into topic/misc 2010-09-03 22:38:52 +02:00
endpoint.h
format.c ALSA: usb-audio: add Edirol SD-90 PCM support 2011-01-10 16:47:10 +01:00
format.h
helper.c ALSA: usb: USB3 SuperSpeed sound support 2010-08-14 10:30:08 +02:00
helper.h
midi.c ALSA: snd-usb-us122l: Fix MIDI output 2011-01-11 19:48:58 +01:00
midi.h
mixer.c ALSA: usbaudio - Enable the E-MU 0204 USB 2011-02-08 08:36:04 +01:00
mixer.h
mixer_maps.c
mixer_quirks.c ALSA: usb-audio - Support for Power/Status LED on Creative USB X-Fi S51 2010-11-02 12:40:11 +01:00
mixer_quirks.h
pcm.c ALSA: usb-audio: fix oops due to cleanup race when disconnecting 2011-02-23 08:15:43 +01:00
pcm.h
proc.c ALSA: usb-audio: automatically detect feedback format 2010-10-27 09:17:41 +02:00
proc.h
quirks-table.h ALSA: usbaudio - Enable the E-MU 0204 USB 2011-02-08 08:36:04 +01:00
quirks.c ALSA: usbaudio - Enable the E-MU 0204 USB 2011-02-08 08:36:04 +01:00
quirks.h
urb.c ALSA: usb-audio: automatically detect feedback format 2010-10-27 09:17:41 +02:00
urb.h
usbaudio.h ALSA: usb-audio: fix oops due to cleanup race when disconnecting 2011-02-23 08:15:43 +01:00