aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2013-12-20 14:39:50 +0800
committerJon Medhurst <tixy@linaro.org>2015-03-27 15:55:21 +0000
commit5a7f714374d2d8d1c2068c2c66f9d8e4ae2745eb (patch)
treeb4e944e082fbe360cf063fd823df67e229748c96 /sound
parentda34a1afee6bdca78d1ef59e182921beaca9052c (diff)
ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
The name of cpu DAI maybe omitted, and then strlen() will lead kernel panic. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> (cherry picked from commit dd41e0c4e35abc5a5679762ab108a6fcd9a0ead9) Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7a9b6b4898c0..be7c1db5388f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -142,6 +142,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
if (ret < 0)
return ret;
+ if (!info->cpu_dai.name || !info->codec_dai.name)
+ return -EINVAL;
+
/* card name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,
strlen(info->cpu_dai.name) +