]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: codecs: pcm512x: fix null-ptr dereference in pcm512x_overclock_xxx_put()
authorJeongjun Park <aha310510@gmail.com>
Thu, 21 May 2026 11:37:12 +0000 (20:37 +0900)
committerMark Brown <broonie@kernel.org>
Thu, 21 May 2026 18:28:24 +0000 (19:28 +0100)
In the pcm512x chipset driver, pcm512x_overclock_xxx_put() is defined as
a general mixer kcontrol instead of a DAPM kcontrol, so struct
snd_soc_dapm_context must not be accessed via
snd_soc_dapm_kcontrol_to_dapm().

This causes a NULL pointer dereference, so it must be modified to use
snd_soc_component_to_dapm().

Cc: stable@kernel.org
Closes: https://github.com/raspberrypi/linux/issues/7242
Fixes: 02dbbb7e982a ("ASoC: codecs: pcm512x: convert to snd_soc_dapm_xxx()")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Link: https://patch.msgid.link/20260521113712.227438-1-aha310510@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/pcm512x.c

index a70e8ea166dc518b26ec8ca6acca2a9817214df4..fdef98ce52f19b5c8c92470c3c5fa8e841d666db 100644 (file)
@@ -235,7 +235,7 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
+       struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
        struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
 
        switch (snd_soc_dapm_get_bias_level(dapm)) {
@@ -264,7 +264,7 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
+       struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
        struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
 
        switch (snd_soc_dapm_get_bias_level(dapm)) {
@@ -293,7 +293,7 @@ static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-       struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
+       struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
        struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
 
        switch (snd_soc_dapm_get_bias_level(dapm)) {