Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: pcm: Improve the fix for race of buffer access at PCM OSS layer

Handle the error code from snd_pcm_buffer_access_lock() in
snd_pcm_runtime_buffer_set_silence() function.

Found by Alexandros Panagiotou <apanagio@redhat.com>

Fixes: 93a81ca06577 ("ALSA: pcm: Fix race of buffer access at PCM OSS layer")
Cc: stable@vger.kernel.org # 6.15
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://patch.msgid.link/20260107213642.332954-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Jaroslav Kysela and committed by
Takashi Iwai
47c27c9c 9ed7a282

+11 -4
+1 -1
include/sound/pcm.h
··· 1402 1402 #define snd_pcm_lib_mmap_iomem NULL 1403 1403 #endif 1404 1404 1405 - void snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime); 1405 + int snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime); 1406 1406 1407 1407 /** 1408 1408 * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer
+3 -1
sound/core/oss/pcm_oss.c
··· 1074 1074 runtime->oss.params = 0; 1075 1075 runtime->oss.prepare = 1; 1076 1076 runtime->oss.buffer_used = 0; 1077 - snd_pcm_runtime_buffer_set_silence(runtime); 1077 + err = snd_pcm_runtime_buffer_set_silence(runtime); 1078 + if (err < 0) 1079 + goto failure; 1078 1080 1079 1081 runtime->oss.period_frames = snd_pcm_alsa_frames(substream, oss_period_size); 1080 1082
+7 -2
sound/core/pcm_native.c
··· 730 730 } 731 731 732 732 /* fill the PCM buffer with the current silence format; called from pcm_oss.c */ 733 - void snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime) 733 + int snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime) 734 734 { 735 - snd_pcm_buffer_access_lock(runtime); 735 + int err; 736 + 737 + err = snd_pcm_buffer_access_lock(runtime); 738 + if (err < 0) 739 + return err; 736 740 if (runtime->dma_area) 737 741 snd_pcm_format_set_silence(runtime->format, runtime->dma_area, 738 742 bytes_to_samples(runtime, runtime->dma_bytes)); 739 743 snd_pcm_buffer_access_unlock(runtime); 744 + return 0; 740 745 } 741 746 EXPORT_SYMBOL_GPL(snd_pcm_runtime_buffer_set_silence); 742 747