linux/sound/core
Takashi Iwai 8b3c009772 ALSA: pcm: Clear the full allocated memory at hw_params
[ Upstream commit 618de0f4ef11acd8cf26902e65493d46cc20cc89 ]

The PCM hw_params core function tries to clear up the PCM buffer
before actually using for avoiding the information leak from the
previous usages or the usage before a new allocation.  It performs the
memset() with runtime->dma_bytes, but this might still leave some
remaining bytes untouched; namely, the PCM buffer size is aligned in
page size for mmap, hence runtime->dma_bytes doesn't necessarily cover
all PCM buffer pages, and the remaining bytes are exposed via mmap.

This patch changes the memory clearance to cover the all buffer pages
if the stream is supposed to be mmap-ready (that guarantees that the
buffer size is aligned in page size).

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201218145625.2045-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-01-06 14:48:40 +01:00
..
oss ALSA: pcm: oss: Fix a few more UBSAN fixes 2020-12-30 11:51:33 +01:00
seq ALSA: seq: Use bool for snd_seq_queue internal flags 2021-01-06 14:48:38 +01:00
Kconfig
Makefile
compress_offload.c ALSA: compress: fix partial_drain completion state 2020-07-16 08:16:39 +02:00
control.c ALSA: ctl: fix error path at adding user-defined element set 2020-11-24 13:29:20 +01:00
control_compat.c
ctljack.c
device.c
hrtimer.c
hwdep.c ALSA: hwdep: fix a left shifting 1 by 31 UB bug 2020-06-03 08:21:22 +02:00
hwdep_compat.c
info.c ALSA: info: Drop WARN_ON() from buffer NULL sanity check 2020-07-29 10:18:30 +02:00
info_oss.c
init.c
isadma.c
jack.c
memalloc.c ALSA: core: memalloc: add page alignment for iram 2020-12-30 11:51:34 +01:00
memory.c
misc.c
pcm.c
pcm_compat.c
pcm_dmaengine.c
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c ALSA: pcm: fix incorrect hw_base increase 2020-05-27 17:46:39 +02:00
pcm_local.h
pcm_memory.c
pcm_misc.c
pcm_native.c ALSA: pcm: Clear the full allocated memory at hw_params 2021-01-06 14:48:40 +01:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
rawmidi.c ALSA: rawmidi: Access runtime->avail always in spinlock 2021-01-06 14:48:38 +01:00
rawmidi_compat.c
seq_device.c
sgbuf.c
sound.c
sound_oss.c
timer.c ALSA: timer: Limit max amount of slave instances 2019-12-31 16:44:47 +01:00
timer_compat.c
vmaster.c