[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190610125344.18221-1-jbrunet@baylibre.com>
Date: Mon, 10 Jun 2019 14:53:44 +0200
From: Jerome Brunet <jbrunet@...libre.com>
To: Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Kevin Hilman <khilman@...libre.com>
Cc: Jerome Brunet <jbrunet@...libre.com>, alsa-devel@...a-project.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-amlogic@...ts.infradead.org,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: [PATCH] ASoC: meson: axg-card: fix null pointer dereference in clean up
When using modern dai_link style, we must first make sure the
struct snd_soc_dai_link_component exists before accessing its members.
In case of early probe deferral, some of the '.cpus' or '.codecs' may not
have been allocated yet. Check this before calling of_node_put() on the
structure member.
Fixes: c84836d7f650 ("ASoC: meson: axg-card: use modern dai_link style")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Signed-off-by: Jerome Brunet <jbrunet@...libre.com>
---
sound/soc/meson/axg-card.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c
index fb03258d00ae..70bb0cbad233 100644
--- a/sound/soc/meson/axg-card.c
+++ b/sound/soc/meson/axg-card.c
@@ -115,9 +115,11 @@ static void axg_card_clean_references(struct axg_card *priv)
if (card->dai_link) {
for_each_card_prelinks(card, i, link) {
- of_node_put(link->cpus->of_node);
+ if (link->cpus)
+ of_node_put(link->cpus->of_node);
for_each_link_codecs(link, j, codec)
- of_node_put(codec->of_node);
+ if (codec)
+ of_node_put(codec->of_node);
}
}
--
2.20.1
Powered by blists - more mailing lists