android_kernel_samsung_msm8976/sound
Takashi Iwai de3313d536 ALSA: pcm: Fix UAF at PCM release via PCM timer access
commit a820ccbe21e8ce8e86c39cd1d3bc8c7d1cbb949b upstream.

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
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:52:18 +02:00
..
aoa
arm ASoC: fix broken pxa SoC support 2015-10-22 14:37:50 -07:00
atmel
core ALSA: pcm: Fix UAF at PCM release via PCM timer access 2019-07-27 21:52:18 +02:00
drivers ALSA: aloop: Fix racy hw constraints adjustment 2019-07-27 21:46:27 +02:00
firewire
i2c
isa
mips
oss sound/oss: fix deadlock in sequencer_ioctl(SNDCTL_SEQ_OUTOFBAND) 2015-05-17 09:51:33 -07:00
parisc
pci This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
pcmcia
ppc
sh
soc ASoC: msm: qdspv2: initialize variables before use 2019-07-27 21:51:25 +02:00
sparc
spi
synth ALSA: synth: Fix conflicting OSS device registration on AWE32 2015-10-22 14:37:50 -07:00
usb ALSA: usb-audio: Fix the missing ctl name suffix at parsing SU 2019-07-27 21:46:20 +02:00
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c
sound_firmware.c