summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-05-16 10:08:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-04 14:40:20 +0200
commitf3e14d706ec18faf19f5a6e75060e140fea05d4a (patch)
tree3981ebec1e6cfa65e60efe51fb50505880e05a0f /include
parent6d7d458c41b98a5c1670cbd36f2923c37de51cf5 (diff)
downloadlinux-f3e14d706ec18faf19f5a6e75060e140fea05d4a.tar.gz
linux-f3e14d706ec18faf19f5a6e75060e140fea05d4a.tar.bz2
linux-f3e14d706ec18faf19f5a6e75060e140fea05d4a.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/sound/pcm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 27040b472a4f..51881ffbd155 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1429,6 +1429,8 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
#define snd_pcm_lib_mmap_iomem NULL
#endif
+void snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime);
+
/**
* snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer
* @dma: DMA number