Jelajahi Sumber

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>
Xiubo Li 12 tahun lalu
induk
melakukan
dd41e0c4e3
1 mengubah file dengan 3 tambahan dan 0 penghapusan
  1. 3 0
      sound/soc/generic/simple-card.c

+ 3 - 0
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)   +