Skip to content

Commit

Permalink
ASoC: dapm: Fix potential DAI widget pointer deref when linking DAIs
Browse files Browse the repository at this point in the history
Sometime a component or topology may configure a DAI widget with no
private data leading to a dev_dbg() dereferencne of this data.

Fix this to check for non NULL private data and let users know if widget
is missing DAI.

Signed-off-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
lrgirdwo authored and broonie committed Jun 18, 2018
1 parent 5544717 commit e01b4f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4073,6 +4073,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
continue;
}

/* let users know there is no DAI to link */
if (!dai_w->priv) {
dev_dbg(card->dev, "dai widget %s has no DAI\n",
dai_w->name);
continue;
}

dai = dai_w->priv;

/* ...find all widgets with the same stream and link them */
Expand Down

0 comments on commit e01b4f6

Please sign in to comment.