Skip to content

Commit

Permalink
ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_ea…
Browse files Browse the repository at this point in the history
…ch_link()

[ Upstream commit 8ab2d12 ]

The of_get_next_child() returns a node with refcount incremented, and
decrements the refcount of prev. So in the error path of the while loop,
of_node_put() needs be called for cpu_ep.

Fixes: fce9b90 ("ASoC: audio-graph-card: cleanup DAI link loop method - step2")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/1670228127-13835-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
wangyufen316 authored and gregkh committed Dec 31, 2022
1 parent 9ff0731 commit 85eb5c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/generic/audio-graph-card.c
Expand Up @@ -483,8 +483,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv,
of_node_put(codec_ep);
of_node_put(codec_port);

if (ret < 0)
if (ret < 0) {
of_node_put(cpu_ep);
return ret;
}

codec_port_old = codec_port;
}
Expand Down

0 comments on commit 85eb5c9

Please sign in to comment.