[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250514133409.713-1-vulab@iscas.ac.cn>
Date: Wed, 14 May 2025 21:34:08 +0800
From: Wentao Liang <vulab@...as.ac.cn>
To: cezary.rojewski@...el.com,
liam.r.girdwood@...ux.intel.com,
peter.ujfalusi@...ux.intel.com,
yung-chuan.liao@...ux.intel.com,
ranjani.sridharan@...ux.intel.com,
kai.vehmanen@...ux.intel.com,
pierre-louis.bossart@...ux.dev,
broonie@...nel.org,
perex@...ex.cz,
tiwai@...e.com
Cc: kuninori.morimoto.gx@...esas.com,
tony.luck@...el.com,
amadeuszx.slawinski@...ux.intel.com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
Wentao Liang <vulab@...as.ac.cn>,
stable@...r.kernel.org
Subject: [PATCH] ASoC: Intel: avs: Add null pointer check for es8366
The avs_card_suspend_pre() and avs_card_resume_post() in es8336
calls the snd_soc_card_get_codec_dai(), but does not check its return
value which is a null pointer if the function fails. This can result
in a null pointer dereference. A proper implementation can be found
in acp5x_nau8821_hw_params() and card_suspend_pre().
Add a null pointer check for snd_soc_card_get_codec_dai() to avoid null
pointer dereference when the function fails.
Fixes: 32e40c8d6ff9 ("ASoC: Intel: avs: Add es8336 machine board")
Cc: stable@...r.kernel.org # v6.6
Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
---
sound/soc/intel/avs/boards/es8336.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c
index 426ce37105ae..e31cc656f076 100644
--- a/sound/soc/intel/avs/boards/es8336.c
+++ b/sound/soc/intel/avs/boards/es8336.c
@@ -243,6 +243,9 @@ static int avs_card_suspend_pre(struct snd_soc_card *card)
{
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, ES8336_CODEC_DAI);
+ if (!codec_dai)
+ return -EINVAL;
+
return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
}
@@ -251,6 +254,9 @@ static int avs_card_resume_post(struct snd_soc_card *card)
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, ES8336_CODEC_DAI);
struct avs_card_drvdata *data = snd_soc_card_get_drvdata(card);
+ if (!codec_dai)
+ return -EINVAL;
+
return snd_soc_component_set_jack(codec_dai->component, &data->jack, NULL);
}
--
2.42.0.windows.2
Powered by blists - more mailing lists