linux-stable/sound/isa/sb
Takashi Iwai 2b3cdf5819 ALSA: sb: Fix potential ABBA deadlock in CSP driver
commit 1c2b951915 upstream.

SB16 CSP driver may hit potentially a typical ABBA deadlock in two
code paths:

 In snd_sb_csp_stop():
     spin_lock_irqsave(&p->chip->mixer_lock, flags);
     spin_lock(&p->chip->reg_lock);

 In snd_sb_csp_load():
     spin_lock_irqsave(&p->chip->reg_lock, flags);
     spin_lock(&p->chip->mixer_lock);

Also the similar pattern is seen in snd_sb_csp_start().

Although the practical impact is very small (those states aren't
triggered in the same running state and this happens only on a real
hardware, decades old ISA sound boards -- which must be very difficult
to find nowadays), it's a real scenario and has to be fixed.

This patch addresses those deadlocks by splitting the locks in
snd_sb_csp_start() and snd_sb_csp_stop() for avoiding the nested
locks.

Reported-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/7b0fcdaf-cd4f-4728-2eae-48c151a92e10@gmail.com
Link: https://lore.kernel.org/r/20210716132723.13216-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-28 14:35:42 +02:00
..
emu8000.c ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer 2021-05-11 14:47:32 +02:00
emu8000_callback.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
emu8000_local.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
emu8000_patch.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
emu8000_pcm.c ALSA: emu8000: Fix the cast to __user pointer 2020-02-10 08:26:38 +01:00
emu8000_synth.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
jazz16.c ALSA: sb: More constifications 2020-01-05 16:15:00 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sb8.c Revert "ALSA: sb8: add a check for request_region" 2021-05-26 12:06:51 +02:00
sb8_main.c ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
sb8_midi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sb16.c ALSA: sb: More constifications 2020-01-05 16:15:00 +01:00
sb16_csp.c ALSA: sb: Fix potential ABBA deadlock in CSP driver 2021-07-28 14:35:42 +02:00
sb16_main.c Revert "ALSA: sb: fix a missing check of snd_ctl_add" 2021-06-03 09:00:40 +02:00
sb_common.c ALSA: isa: Constify snd_device_ops definitions 2020-01-03 09:23:54 +01:00
sb_mixer.c ALSA: sb: More constifications 2020-01-05 16:15:00 +01:00
sbawe.c