kernel_optimize_test/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 ALSA: aoa: onyx: always initialize register read value 2019-07-29 09:21:39 +02:00
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 ALSA: sb: remove redundant assignment to variable result 2019-08-14 17:44:06 +02:00
mips
oss sound: dmasound_atari: Mark expected switch fall-through 2019-07-30 09:36:13 +02:00
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 ALSA: sparc: Mark expected switch fall-throughs 2019-07-30 09:37:01 +02:00
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
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c sound: fix a memory leak bug 2019-08-08 08:18:32 +02:00