kernel_optimize_test/sound/core
Takashi Iwai a820ccbe21 ALSA: pcm: Fix UAF at PCM release via PCM timer access
The PCM runtime object is created and freed dynamically at PCM stream
open / close time.  This is tracked via substream->runtime, and it's
cleared at snd_pcm_detach_substream().

The runtime object assignment is protected by PCM open_mutex, so for
all PCM operations, it's safely handled.  However, each PCM substream
provides also an ALSA timer interface, and user-space can access to
this while closing a PCM substream.  This may eventually lead to a
UAF, as snd_pcm_timer_resolution() tries to access the runtime while
clearing it in other side.

Fortunately, it's the only concurrent access from the PCM timer, and
it merely reads runtime->timer_resolution field.  So, we can avoid the
race by reordering kfree() and wrapping the substream->runtime
clearance with the corresponding timer lock.

Reported-by: syzbot+8e62ff4e07aa2ce87826@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-04-03 08:36:40 +02:00
..
oss Merge branch 'for-next' into for-linus 2018-04-02 19:50:59 +02:00
seq ALSA: seq: Clear client entry before deleting else at closing 2018-03-10 17:30:01 +01:00
compress_offload.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
control_compat.c
control.c ALSA: control: Fix a bunch of whitespace errors 2018-02-28 08:18:26 +01:00
ctljack.c
device.c
hrtimer.c
hwdep_compat.c
hwdep.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
info_oss.c
info.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
init.c ALSA: Use scnprintf() instead of snprintf() for show 2018-02-27 09:16:52 +01:00
isadma.c
jack.c
Kconfig
Makefile
memalloc.c
memory.c
misc.c
pcm_compat.c
pcm_dmaengine.c
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c ALSA: pcm: Use krealloc() for resizing the rules array 2018-03-13 15:37:58 +01:00
pcm_local.h
pcm_memory.c
pcm_misc.c ALSA: pcm: add SNDRV_PCM_FORMAT_{S,U}20 2017-11-29 09:26:33 +01:00
pcm_native.c Merge branch 'for-next' into for-linus 2018-04-02 19:50:59 +02:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
pcm.c ALSA: pcm: Fix UAF at PCM release via PCM timer access 2018-04-03 08:36:40 +02:00
rawmidi_compat.c
rawmidi.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
seq_device.c
sgbuf.c
sound_oss.c
sound.c
timer_compat.c ALSA: timer: Remove kernel warning at compat ioctl error paths 2017-11-21 16:36:11 +01:00
timer.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
vmaster.c ALSA: vmaster: Zero-clear ctl before calling slave get 2018-03-08 08:41:13 +01:00