]> Pileus Git - ~andy/linux/commitdiff
ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
authorXiubo Li <Li.Xiubo@freescale.com>
Fri, 20 Dec 2013 06:39:50 +0000 (14:39 +0800)
committerMark Brown <broonie@linaro.org>
Sat, 21 Dec 2013 14:42:48 +0000 (14:42 +0000)
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>
sound/soc/generic/simple-card.c

index 7a9b6b4898c02dde4dcca9669bfb6ff93e226651..be7c1db5388faddcb4f6477b345ed5efba4abc9e 100644 (file)
@@ -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)   +