linux/sound
Takashi Iwai a393318673 ALSA: timer: Fix mutex deadlock at releasing card
When a card is disconnected while in use, the system waits until all
opened files are closed then releases the card.  This is done via
put_device() of the card device in each device release code.

The recently reported mutex deadlock bug happens in this code path;
snd_timer_close() for the timer device deals with the global
register_mutex and it calls put_device() there.  When this timer
device is the last one, the card gets freed and it eventually calls
snd_timer_free(), which has again the protection with the global
register_mutex -- boom.

Basically put_device() call itself is race-free, so a relative simple
workaround is to move this put_device() call out of the mutex.  For
achieving that, in this patch, snd_timer_close_locked() got a new
argument to store the card device pointer in return, and each caller
invokes put_device() with the returned object after the mutex unlock.

Reported-and-tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-30 22:54:56 +01:00
..
ac97
aoa
arm
atmel
core ALSA: timer: Fix mutex deadlock at releasing card 2019-10-30 22:54:56 +01:00
drivers
firewire ALSA: bebob: Fix prototype of helper function to return negative value 2019-10-26 09:06:20 +02:00
hda Revert "ALSA: hda: Flush interrupts on disabling" 2019-10-28 11:47:59 +01:00
i2c
isa
mips
oss
parisc
pci ALSA: hda - Fix mutex deadlock in HDMI codec driver 2019-10-30 15:32:37 +01:00
pcmcia
ppc
sh
soc ASoC: Fixes for v5.4 2019-10-21 14:05:26 +02:00
sparc
spi
synth
usb ALSA: usb-audio: Add DSD support for Gustard U16/X26 USB Interface 2019-10-24 12:30:06 +02:00
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c