linux-stable/sound
Takashi Iwai 2a3f7221ac ALSA: core: Fix card races between register and disconnect
There is a small race window in the card disconnection code that
allows the registration of another card with the very same card id.
This leads to a warning in procfs creation as caught by syzkaller.

The problem is that we delete snd_cards and snd_cards_lock entries at
the very beginning of the disconnection procedure.  This makes the
slot available to be assigned for another card object while the
disconnection procedure is being processed.  Then it becomes possible
to issue a procfs registration with the existing file name although we
check the conflict beforehand.

The fix is simply to move the snd_cards and snd_cards_lock clearances
at the end of the disconnection procedure.  The references to these
entries are merely either from the global proc files like
/proc/asound/cards or from the card registration / disconnection, so
it should be fine to shift at the very end.

Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-04-16 17:06:33 +02:00
..
ac97 ALSA: ac97: Fix of-node refcount unbalance 2019-02-19 22:20:14 +01:00
aoa ALSA: aoa: Fix of-node refcount unbalance 2019-02-19 22:20:45 +01:00
arm ALSA: arm: Avoid passing NULL to memory allocators 2019-02-04 16:51:46 +01:00
atmel ALSA: atmel: Drop superfluous PCM preallocation error checks 2019-02-06 10:28:39 +01:00
core ALSA: core: Fix card races between register and disconnect 2019-04-16 17:06:33 +02:00
drivers ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration 2019-03-18 13:50:46 +01:00
firewire ALSA: firewire-motu: use 'version' field of unit directory to identify model 2019-03-17 08:07:21 +01:00
hda ASoC: Fixes for v5.1 2019-04-11 14:36:30 +02:00
i2c ALSA: i2c: Clean up with new procfs helpers 2019-02-06 18:11:56 +01:00
isa ALSA: sb8: add a check for request_region 2019-03-16 10:30:27 +01:00
mips ALSA: mips: pass struct device to DMA API functions 2019-02-01 17:15:44 +01:00
oss
parisc ALSA: parisc: Drop superfluous PCM preallocation error checks 2019-02-06 10:29:03 +01:00
pci ALSA: hda: Initialize power_state field properly 2019-04-13 10:04:49 +02:00
pcmcia ALSA: pcmcia: Clean up with new procfs helpers 2019-02-06 18:11:57 +01:00
ppc ALSA: ppc: Fix of-node refcount unbalance 2019-02-19 22:20:46 +01:00
sh ALSA: sh: Drop superfluous PCM preallocation error checks 2019-02-06 10:29:24 +01:00
soc ASoC: wcd9335: Fix missing regmap requirement 2019-04-10 17:07:59 +01:00
sparc ASoC: Updates for v5.1 2019-02-08 14:20:32 +01:00
spi ALSA: spi: Drop superfluous PCM preallocation error checks 2019-02-06 10:29:36 +01:00
synth ALSA: emux: Remove superfluous snd_info_register() calls 2019-02-06 18:11:53 +01:00
usb ALSA: usx2y: Fix potential NULL pointer dereference 2019-03-13 11:27:06 +01:00
x86 ALSA: x86: Avoid passing NULL to memory allocators 2019-02-04 16:51:34 +01:00
xen ALSA: xen-front: Do not use stream buffer size before it is set 2019-04-04 14:44:18 +02:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c