Skip to content

Commit 4d4e1b6

Browse files
nfrapradobroonie
authored andcommitted
ASoC: mediatek: mt8192: Check existence of dai_name before dereferencing
Following commit 13f5826 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()"), the dai_name field is only populated for dummy components after the card is registered. This causes a null pointer dereference in the mt8192-mt6359 sound card driver's probe function when searching for a dai_name among all the card's dai links. Verify that the dai_name is non-null before passing it to strcmp. While at it, also check that there's at least one codec. Reported-by: kernelci.org bot <[email protected]> Closes: https://linux.kernelci.org/test/case/id/6582cd6d992645c680e13478/ Fixes: 13f5826 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()") Signed-off-by: Nícolas F. R. A. Prado <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3ec7129 commit 4d4e1b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
12081208
dai_link->ignore = 0;
12091209
}
12101210

1211-
if (strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
1211+
if (dai_link->num_codecs && dai_link->codecs[0].dai_name &&
1212+
strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
12121213
dai_link->ops = &mt8192_rt1015_i2s_ops;
12131214

12141215
if (!dai_link->platforms->name)

0 commit comments

Comments
 (0)