linux/sound
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
..
aoa
arm
atmel
core ALSA: Fix card refcount unbalance 2012-11-08 14:36:18 +01:00
drivers ALSA: aloop - add locking to timer access 2012-10-06 16:50:28 +02:00
firewire
i2c ALSA: Fix typo in drivers sound 2012-11-04 09:20:58 +01:00
isa ALSA: sound/isa/opti9xx/miro.c: eliminate possible double free 2012-10-21 14:17:43 +02:00
mips
oss ARM: SoC fixes 2012-10-11 10:21:48 +09:00
parisc
pci ALSA: fm801: precedence bug in snd_fm801_tea575x_get_pins() 2012-11-14 09:34:28 +01:00
pcmcia
ppc
sh
soc Merge branches 'fix/arizona', 'fix/core', 'fix/cs42l52', 'fix/mxs', 'fix/samsung' and 'fix/wm8978' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into tmp 2012-11-13 15:13:29 +09:00
sparc sound: Remove unnecessary semicolon 2012-10-06 16:47:53 +02:00
spi
synth
usb ALSA: usb-audio: Fix mutex deadlock at disconnection 2012-11-14 15:29:09 +01:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c
sound_firmware.c