Skip to contentSkip to conversation

ASoC: topology: Check name strings of physical DAI links

PATCH In review [email protected] 2 participants 2 messages Nov 5, 2016 – Nov 9, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: topology: Check name strings of physical DAI links

From: Mengdong Lin <[email protected]>

Check if the name strings are properly terminated, and only use valid name strings to find existing physical DAI links to configure.

sound/soc/soc-topology.c +16 -2
index 8772fd9..4dfdc65 100644
@@ -1994,10 +1994,24 @@ static int soc_tplg_link_config(struct soc_tplg *tplg,
 {
 	struct snd_soc_dai_link *link;
 	const char *name, *stream_name;
+	size_t len;
 	int ret;
 
-	name = strlen(cfg->name) ? cfg->name : NULL;
-	stream_name = strlen(cfg->stream_name) ? cfg->stream_name : NULL;
+	len = strnlen(cfg->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+	if (len == SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
+		return -EINVAL;
+	else if (len)
+		name = cfg->name;
+	else
+		name = NULL;
+
+	len = strnlen(cfg->stream_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+	if (len == SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
+		return -EINVAL;
+	else if (len)
+		stream_name = cfg->stream_name;
+	else
+		stream_name = NULL;
 
 	link = snd_soc_find_dai_link(tplg->comp->card, cfg->id,
 				     name, stream_name);
Signature · 1 line
2.7.4
maintainer
#1 lore raw

Applied "ASoC: topology: Check name strings of physical DAI links" to the asoc tree

The patch

ASoC: topology: Check name strings of physical DAI links

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

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

Quoted 1 line

From dbab1cb88e84813254091d0d02ab83d9929e6a27 Mon Sep 17 00:00:00 2001

From: Mengdong Lin <[email protected]>
Date: Sat, 5 Nov 2016 08:42:14 +0800
Subject: [PATCH] ASoC: topology: Check name strings of physical DAI links

Check if the name strings are properly terminated, and only use valid name strings to find existing physical DAI links to configure.

---
 sound/soc/soc-topology.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
sound/soc/soc-topology.c +16 -2
index 8772fd994e82..4dfdc656cce6 100644
@@ -1994,10 +1994,24 @@ static int soc_tplg_link_config(struct soc_tplg *tplg,
 {
 	struct snd_soc_dai_link *link;
 	const char *name, *stream_name;
+	size_t len;
 	int ret;
 
-	name = strlen(cfg->name) ? cfg->name : NULL;
-	stream_name = strlen(cfg->stream_name) ? cfg->stream_name : NULL;
+	len = strnlen(cfg->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+	if (len == SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
+		return -EINVAL;
+	else if (len)
+		name = cfg->name;
+	else
+		name = NULL;
+
+	len = strnlen(cfg->stream_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+	if (len == SNDRV_CTL_ELEM_ID_NAME_MAXLEN)
+		return -EINVAL;
+	else if (len)
+		stream_name = cfg->stream_name;
+	else
+		stream_name = NULL;
 
 	link = snd_soc_find_dai_link(tplg->comp->card, cfg->id,
 				     name, stream_name);
Signature · 1 line
2.10.2