1 From 849ed10b1bd62def81722cc1ccf5f9f547268342 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Tue, 5 Mar 2024 15:56:06 +0900
4 Subject: ASoC: soc-core.c: Skip dummy codec when adding platforms
6 From: Chancel Liu <chancel.liu@nxp.com>
8 [ Upstream commit 23fb6bc2696119391ec3a92ccaffe50e567c515e ]
10 When pcm_runtime is adding platform components it will scan all
11 registered components. In case of DPCM FE/BE some DAI links will
12 configure dummy platform. However both dummy codec and dummy platform
13 are using "snd-soc-dummy" as component->name. Dummy codec should be
14 skipped when adding platforms otherwise there'll be overflow and UBSAN
17 Reported-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
18 Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
19 Link: https://msgid.link/r/20240305065606.3778642-1-chancel.liu@nxp.com
20 Signed-off-by: Mark Brown <broonie@kernel.org>
21 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 sound/soc/soc-core.c | 3 +++
24 1 file changed, 3 insertions(+)
26 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
27 index a5b3ee69fb886..1c4d8b96f77b1 100644
28 --- a/sound/soc/soc-core.c
29 +++ b/sound/soc/soc-core.c
30 @@ -1042,6 +1042,9 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
31 if (!snd_soc_is_matching_component(platform, component))
34 + if (snd_soc_component_is_dummy(component) && component->num_dai)
37 snd_soc_rtd_add_component(rtd, component);