* [PATCH] ASoC: meson: axg-card: fix null pointer dereference in clean up
@ 2019-06-10 12:53 Jerome Brunet
0 siblings, 0 replies; only message in thread
From: Jerome Brunet @ 2019-06-10 12:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Kevin Hilman
Cc: devicetree, alsa-devel, Kuninori Morimoto, linux-kernel,
linux-amlogic, Jerome Brunet
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@renesas.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.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
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-10 12:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 12:53 [PATCH] ASoC: meson: axg-card: fix null pointer dereference in clean up Jerome Brunet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®