linux/sound/core
Takashi Iwai e190161f96 ALSA: pcm: Fix tight loop of OSS capture stream
When the trigger=off is passed for a PCM OSS stream, it sets the
start_threshold of the given substream to the boundary size, so that
it won't be automatically started.  This can be problematic for a
capture stream, unfortunately, as detected by syzkaller.  The scenario
is like the following:

- In __snd_pcm_lib_xfer() that is invoked from snd_pcm_oss_read()
  loop, we have a check whether the stream was already started or the
  stream can be auto-started.
- The function at this check returns 0 with trigger=off since we
  explicitly disable the auto-start.
- The loop continues and repeats calling __snd_pcm_lib_xfer() tightly,
  which may lead to an RCU stall.

This patch fixes the bug by simply allowing the wait for non-started
stream in the case of OSS capture.  For native usages, it's supposed
to be done by the caller side (which is user-space), hence it returns
zero like before.

(In theory, __snd_pcm_lib_xfer() could wait even for the native API
 usage cases, too; but I'd like to stay in a safer side for not
 breaking the existing stuff for now.)

Reported-by: syzbot+fbe0496f92a0ce7b786c@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-25 19:45:46 +01:00
..
oss ALSA: oss: Use kvzalloc() for local buffer allocations 2018-11-09 14:12:04 +01:00
seq Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
Kconfig
Makefile
compress_offload.c ALSA: compress: prevent potential divide by zero bugs 2019-01-03 16:32:57 +00:00
control.c ALSA: control: Consolidate helpers for adding and replacing ctl elements 2018-11-24 20:04:10 +01:00
control_compat.c
ctljack.c
device.c
hrtimer.c
hwdep.c
hwdep_compat.c
info.c
info_oss.c
init.c
isadma.c
jack.c
memalloc.c ALSA: memalloc: Add fall-through annotation 2018-10-12 09:31:23 +02:00
memory.c
misc.c
pcm.c ALSA: pcm: Fix potential Spectre v1 vulnerability 2018-12-13 09:14:33 +01:00
pcm_compat.c
pcm_dmaengine.c
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c ALSA: pcm: Fix tight loop of OSS capture stream 2019-01-25 19:45:46 +01:00
pcm_local.h
pcm_memory.c
pcm_misc.c
pcm_native.c ALSA: pcm: Fix starvation on down_write_nonblock() 2018-11-29 08:15:19 +01:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
rawmidi.c ALSA: rawmidi: A lightweight function to discard pending bytes 2018-10-04 20:13:17 +02:00
rawmidi_compat.c
seq_device.c
sgbuf.c ALSA: memalloc: Add non-cached buffer type 2018-08-28 13:56:47 +02:00
sound.c
sound_oss.c
timer.c
timer_compat.c
vmaster.c