diff options
author | Wen Yang <wen.yang99@zte.com.cn> | 2019-07-10 03:25:07 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-07-10 11:33:55 -0400 |
commit | 27862d5a3325bc531ec15e3c607e44aa0fd57f6f (patch) | |
tree | 2d50bdb26c3429189e5eb9522c5be5d6171c1384 /sound/soc/generic | |
parent | 724808ad556c15e9473418d082f8aae81dd267f6 (diff) |
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/soc/generic')
-rw-r--r-- | sound/soc/generic/simple-card.c | 4 |
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, | |||
364 | goto error; | 364 | goto error; |
365 | } | 365 | } |
366 | 366 | ||
367 | of_node_put(codec); | ||
368 | |||
369 | /* get convert-xxx property */ | 367 | /* get convert-xxx property */ |
370 | memset(&adata, 0, sizeof(adata)); | 368 | memset(&adata, 0, sizeof(adata)); |
371 | for_each_child_of_node(node, np) | 369 | for_each_child_of_node(node, np) |
@@ -387,11 +385,13 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, | |||
387 | ret = func_noml(priv, np, codec, li, is_top); | 385 | ret = func_noml(priv, np, codec, li, is_top); |
388 | 386 | ||
389 | if (ret < 0) { | 387 | if (ret < 0) { |
388 | of_node_put(codec); | ||
390 | of_node_put(np); | 389 | of_node_put(np); |
391 | goto error; | 390 | goto error; |
392 | } | 391 | } |
393 | } | 392 | } |
394 | 393 | ||
394 | of_node_put(codec); | ||
395 | node = of_get_next_child(top, node); | 395 | node = of_get_next_child(top, node); |
396 | } while (!is_top && node); | 396 | } while (!is_top && node); |
397 | 397 | ||