android_kernel_samsung_msm8976/sound/core
Takashi Iwai 30d0db636f ALSA: core: Fix card races between register and disconnect
commit 2a3f7221acddfe1caa9ff09b3a8158c39b2fdeac upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-27 22:10:10 +02:00
..
oss ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation 2019-07-27 21:52:26 +02:00
seq ALSA: seq: Fix regression by incorrect ioctl_mutex usages 2019-07-27 21:46:10 +02:00
Kconfig ALSA: Add kconfig to specify the max card numbers 2019-07-27 22:10:09 +02:00
Makefile
compress_offload.c This is the 3.10.97 stable release 2017-04-18 17:17:20 +02:00
control.c ALSA: core: Fix unexpected error at replacing user TLV 2019-07-27 21:44:40 +02:00
control_compat.c ALSA: control: fix a redundant-copy issue 2019-07-27 21:52:23 +02:00
ctljack.c
device.c
hrtimer.c ALSA: timer: Limit max instances per timer 2019-07-27 21:45:43 +02:00
hwdep.c
hwdep_compat.c
info.c Merge tag 'LA.BR.1.3.6-03510-8976.0' into HEAD 2017-04-18 12:11:50 +02:00
info_oss.c
init.c ALSA: core: Fix card races between register and disconnect 2019-07-27 22:10:10 +02:00
isadma.c
jack.c
memalloc.c
memory.c
misc.c
pcm.c ALSA: pcm: Fix potential Spectre v1 vulnerability 2019-07-27 22:09:03 +02:00
pcm_compat.c ALSA: pcm: Check PCM state at xfern compat ioctl 2019-07-27 21:49:07 +02:00
pcm_lib.c ALSA: pcm: Remove yet superfluous WARN_ON() 2019-07-27 21:46:29 +02:00
pcm_memory.c
pcm_misc.c
pcm_native.c ALSA: PCM: check if ops are defined before suspending PCM 2019-07-27 22:10:04 +02:00
pcm_timer.c ALSA: pcm: use lock to protect substream runtime resource 2018-01-21 21:32:44 -08:00
rawmidi.c ALSA: rawmidi: Avoid racy info ioctl via ctl device 2019-07-27 21:46:17 +02:00
rawmidi_compat.c ALSA: rawmidi: Fix missing input substream checks in compat ioctls 2019-07-27 21:52:27 +02:00
rtctimer.c
sgbuf.c
sound.c
sound_oss.c
timer.c ALSA: timer: Fix UBSAN warning at SNDRV_TIMER_IOCTL_NEXT_DEVICE ioctl 2019-07-27 21:52:54 +02:00
timer_compat.c ALSA: timer: Remove kernel warning at compat ioctl error paths 2019-07-27 21:46:05 +02:00
vmaster.c