From: Chancel Liu Date: Tue, 5 Mar 2024 06:56:06 +0000 (+0900) Subject: ASoC: soc-core.c: Skip dummy codec when adding platforms X-Git-Tag: v6.6.27~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9afc9fde538b4eaa14f0495fb9bb98d7aed6bc03;p=thirdparty%2Fkernel%2Fstable.git ASoC: soc-core.c: Skip dummy codec when adding platforms [ Upstream commit 23fb6bc2696119391ec3a92ccaffe50e567c515e ] When pcm_runtime is adding platform components it will scan all registered components. In case of DPCM FE/BE some DAI links will configure dummy platform. However both dummy codec and dummy platform are using "snd-soc-dummy" as component->name. Dummy codec should be skipped when adding platforms otherwise there'll be overflow and UBSAN complains. Reported-by: Zhipeng Wang Signed-off-by: Chancel Liu Link: https://msgid.link/r/20240305065606.3778642-1-chancel.liu@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 9de98c01d8151..e65fe3a7c3e42 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1105,6 +1105,9 @@ static int snd_soc_add_pcm_runtime(struct snd_soc_card *card, if (!snd_soc_is_matching_component(platform, component)) continue; + if (snd_soc_component_is_dummy(component) && component->num_dai) + continue; + snd_soc_rtd_add_component(rtd, component); } }