]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: pcm: Fix race of buffer access at PCM OSS layer
authorTakashi Iwai <tiwai@suse.de>
Fri, 16 May 2025 08:08:16 +0000 (10:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:38:06 +0000 (14:38 +0200)
commit10217da9644ae75cea7330f902c35fc5ba78bbbf
treeaaf3ea40adce663810dc4f4641b1e00528358c44
parent0622846db728a5332b917c797c733e202c4620ae
ALSA: pcm: Fix race of buffer access at PCM OSS layer

commit 93a81ca0657758b607c3f4ba889ae806be9beb73 upstream.

The PCM OSS layer tries to clear the buffer with the silence data at
initialization (or reconfiguration) of a stream with the explicit call
of snd_pcm_format_set_silence() with runtime->dma_area.  But this may
lead to a UAF because the accessed runtime->dma_area might be freed
concurrently, as it's performed outside the PCM ops.

For avoiding it, move the code into the PCM core and perform it inside
the buffer access lock, so that it won't be changed during the
operation.

Reported-by: syzbot+32d4647f551007595173@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/68164d8e.050a0220.11da1b.0019.GAE@google.com
Cc: <stable@vger.kernel.org>
Link: https://patch.msgid.link/20250516080817.20068-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/sound/pcm.h
sound/core/oss/pcm_oss.c
sound/core/pcm_native.c