2024-03-05 06:56:45

by Chancel Liu

[permalink] [raw]
Subject: [PATCH] ASoC: soc-core.c: Skip dummy codec when adding platforms

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 <[email protected]>
Signed-off-by: Chancel Liu <[email protected]>
---
sound/soc/soc-core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1e94edba12eb..2ec13d1634b6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1219,6 +1219,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);
}
}
--
2.43.0



2024-03-14 14:16:47

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: soc-core.c: Skip dummy codec when adding platforms

On Tue, 05 Mar 2024 15:56:06 +0900, Chancel Liu wrote:
> 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.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: soc-core.c: Skip dummy codec when adding platforms
commit: 23fb6bc2696119391ec3a92ccaffe50e567c515e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark