diff options
author | Takashi Iwai <tiwai@suse.de> | 2023-08-16 18:02:46 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-08-17 09:23:45 +0200 |
commit | bc41a7228cedc39395d032b2502975e53b7a9180 (patch) | |
tree | aaf5b59beebc5c9616579d4b2bd279e20af07c0a /include/sound | |
parent | ALSA: control: Don't embed ctl_dev (diff) | |
download | linux-bc41a7228cedc39395d032b2502975e53b7a9180.tar.xz linux-bc41a7228cedc39395d032b2502975e53b7a9180.zip |
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>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/pcm.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 19f564606ac4..0243a13e9ac4 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -510,7 +510,7 @@ struct snd_pcm_str { #endif #endif struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ - struct device dev; + struct device *dev; }; struct snd_pcm { |