linux-stable/sound/core
Takashi Iwai bc41a7228c ALSA: pcm: Don't embed device
So far we use the embedded struct device for each PCM substreams in
struct snd_pcm.  This may result in UAF when the delayed kobj release
is used; each corresponding struct device is still accessed at the
(delayed) device release, while the snd_pcm object may be already
gone.

As a workaround, detach the struct device from the snd_pcm object by
allocating via the new snd_device_alloc() helper.

A caveat is that we store the PCM substream pointer to drvdata since
the device resume and others require the access to it.

This patch is based on the fix Curtis posted initially.  In this
patch, the changes are split and use the new helper function instead.

Link: https://lore.kernel.org/r/20230801171928.1460120-1-cujomalainey@chromium.org
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-17 09:23:45 +02:00
..
oss ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers 2023-07-20 10:03:00 +02:00
seq ALSA: seq: Fix memory leak at error path in snd_seq_create_port() 2023-07-17 08:26:15 +02:00
compress_offload.c
control.c ALSA: control: Don't embed ctl_dev 2023-08-17 09:23:30 +02:00
control_compat.c ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers 2023-07-20 10:03:00 +02:00
control_led.c ALSA: control: Don't embed ctl_dev 2023-08-17 09:23:30 +02:00
ctljack.c
device.c
hrtimer.c
hwdep.c
hwdep_compat.c
info.c
info_oss.c
init.c ALSA: core: Introduce snd_device_alloc() 2023-08-17 09:21:40 +02:00
isadma.c
jack.c ALSA: control: Take controls_rwsem lock in snd_ctl_remove() 2023-07-20 10:01:27 +02:00
Kconfig
Makefile
memalloc.c
memalloc_local.h
memory.c
misc.c
pcm.c ALSA: pcm: Don't embed device 2023-08-17 09:23:45 +02:00
pcm_compat.c
pcm_dmaengine.c
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c
pcm_local.h
pcm_memory.c
pcm_misc.c
pcm_native.c
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
rawmidi.c
rawmidi_compat.c
seq_device.c
sound.c
sound_oss.c
timer.c
timer_compat.c
ump.c
ump_convert.c
vmaster.c ALSA: vmaster: Add snd_ctl_add_followers() helper 2023-07-21 09:37:47 +02:00