ASoC: amd: acp: Add null pointer check in acp_max98388_hw_paramsi()
Subsystems (4)
PATCH 1/1 ASoC: amd: acp: Add null pointer check in acp_max98388_hw_paramsi()
The acp_max98388_hw_params() 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.
Add a null pointer check for snd_soc_card_get_codec_dai() to avoid null pointer dereference when the function fails.
Fixes ac91c8c89782 ("ASoC: amd: acp: Add machine driver support for max98388 codec")
Cc [email protected] # v6.6
Signed-off-by Wentao Liang <[email protected]>
--- sound/soc/amd/acp/acp-mach-common.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +3 -0
@@ -918,6 +918,9 @@ static int acp_max98388_hw_params(struct snd_pcm_substream *substream, MAX98388_CODEC_DAI);int ret; +if (codec_dai) +return -EINVAL ; + ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_CBS_CFS |SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF );
Signature · 1 line
2.42.0.windows.2