Commit d783a166 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by liwei
Browse files

ASoC: mediatek: Assign dummy when codec not specified for a DAI link

mainline inclusion
from mainline-v6.10-rc1
commit 5f39231888c63f0a7708abc86b51b847476379d8
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IA6SG2
CVE: CVE-2024-38551

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f39231888c63f0a7708abc86b51b847476379d8



--------------------------------

MediaTek sound card drivers are checking whether a DAI link is present
and used on a board to assign the correct parameters and this is done
by checking the codec DAI names at probe time.

If no real codec is present, assign the dummy codec to the DAI link
to avoid NULL pointer during string comparison.

Fixes: 4302187d ("ASoC: mediatek: common: add soundcard driver common code")
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://msgid.link/r/20240313110147.1267793-5-angelogioacchino.delregno@collabora.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarliwei <liwei728@huawei.com>
parent 0fd3edbf
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -22,7 +22,11 @@ static int set_card_codec_info(struct snd_soc_card *card,

	codec_node = of_get_child_by_name(sub_node, "codec");
	if (!codec_node) {
		dev_dbg(dev, "%s no specified codec\n", dai_link->name);
		dev_dbg(dev, "%s no specified codec: setting dummy.\n", dai_link->name);

		dai_link->codecs = &snd_soc_dummy_dlc;
		dai_link->num_codecs = 1;
		dai_link->dynamic = 1;
		return 0;
	}