mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 02:33:57 +00:00
ASoC: mediatek: mt8192: Check existence of dai_name before dereferencing
Following commit13f58267cd
("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 <bot@kernelci.org> Closes: https://linux.kernelci.org/test/case/id/6582cd6d992645c680e13478/ Fixes:13f58267cd
("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://msgid.link/r/20240108204508.691739-1-nfraprado@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3ec71290db
commit
4d4e1b6319
@ -1208,7 +1208,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev)
|
||||
dai_link->ignore = 0;
|
||||
}
|
||||
|
||||
if (strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
|
||||
if (dai_link->num_codecs && dai_link->codecs[0].dai_name &&
|
||||
strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0)
|
||||
dai_link->ops = &mt8192_rt1015_i2s_ops;
|
||||
|
||||
if (!dai_link->platforms->name)
|
||||
|
Loading…
Reference in New Issue
Block a user