summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorWen Yang <wen.yang99@zte.com.cn>2019-07-10 15:25:07 +0800
committerMark Brown <broonie@kernel.org>2019-07-10 16:33:55 +0100
commit27862d5a3325bc531ec15e3c607e44aa0fd57f6f (patch)
tree2d50bdb26c3429189e5eb9522c5be5d6171c1384 /sound
parent724808ad556c15e9473418d082f8aae81dd267f6 (diff)
downloadlinux-27862d5a3325bc531ec15e3c607e44aa0fd57f6f.tar.gz
ASoC: simple-card: fix an use-after-free in simple_for_each_link()
The codec variable is still being used after the of_node_put() call, which may result in use-after-free. Fixes: d947cdfd4be2 ("ASoC: simple-card: cleanup DAI link loop method - step1") Link: https://lore.kernel.org/r/1562743509-30496-3-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4117e54884e5..ef849151ba56 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -364,8 +364,6 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
goto error;
}
- of_node_put(codec);
-
/* get convert-xxx property */
memset(&adata, 0, sizeof(adata));
for_each_child_of_node(node, np)
@@ -387,11 +385,13 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
ret = func_noml(priv, np, codec, li, is_top);
if (ret < 0) {
+ of_node_put(codec);
of_node_put(np);
goto error;
}
}
+ of_node_put(codec);
node = of_get_next_child(top, node);
} while (!is_top && node);