kernel_optimize_test/sound/usb
Takashi Iwai 10e44239f6 ALSA: usb-audio: Fix mutex deadlock at disconnection
The recent change for USB-audio disconnection race fixes introduced a
mutex deadlock again.  There is a circular dependency between
chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
device is opened during the disconnection operation:

A. snd_usb_audio_disconnect() ->
     card.c::register_mutex ->
       chip->shutdown_rwsem (write) ->
         snd_card_disconnect() ->
           pcm.c::register_mutex ->
             pcm->open_mutex

B. snd_pcm_open() ->
     pcm->open_mutex ->
       snd_usb_pcm_open() ->
         chip->shutdown_rwsem (read)

Since the chip->shutdown_rwsem protection in the case A is required
only for turning on the chip->shutdown flag and it doesn't have to be
taken for the whole operation, we can reduce its window in
snd_usb_audio_disconnect().

Reported-by: Jiri Slaby <jslaby@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-14 15:29:09 +01:00
..
6fire
caiaq
misc
usx2y
card.c ALSA: usb-audio: Fix mutex deadlock at disconnection 2012-11-14 15:29:09 +01:00
card.h
clock.c
clock.h
debug.h
endpoint.c ALSA: usb-audio: Fix crash at re-preparing the PCM stream 2012-11-08 08:56:44 +01:00
endpoint.h ALSA: usb-audio: Fix crash at re-preparing the PCM stream 2012-11-08 08:56:44 +01:00
format.c
format.h
helper.c
helper.h
Kconfig
Makefile
midi.c
midi.h
mixer_maps.c
mixer_quirks.c
mixer_quirks.h
mixer.c
mixer.h
pcm.c ALSA: usb-audio: Fix crash at re-preparing the PCM stream 2012-11-08 08:56:44 +01:00
pcm.h
power.h
proc.c
proc.h
quirks-table.h
quirks.c
quirks.h
stream.c
stream.h
usbaudio.h