From: Xiubo Li Date: Fri, 20 Dec 2013 06:39:50 +0000 (+0800) Subject: ASoC: simple-card: Add cpu_dai and codec_dai names NULL check X-Git-Tag: firefly_0821_release~176^2~4492^2~11^2~38^2~1^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dd41e0c4e35abc5a5679762ab108a6fcd9a0ead9;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Mark Brown --- 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) +