Skip to content

Commit

Permalink
ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xiubo Li authored and Mark Brown committed Dec 21, 2013
1 parent fa558c2 commit dd41e0c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/generic/simple-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand Down

0 comments on commit dd41e0c

Please sign in to comment.