ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link()
authorWang Yufen <wangyufen@huawei.com>
Mon, 5 Dec 2022 08:15:27 +0000 (16:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:45 +0000 (13:14 +0100)
commit85eb5c952b7fe2d2059beaa4a4dd26688b25547b
tree97f6251aae4ecddfcfb72ef2a961982641f9a3bb
parent9ff07316cad22cdbead4dd223b049192fef81f51
ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link()

[ Upstream commit 8ab2d12c726f0fde0692fa5d81d8019b3dcd62d0 ]

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: fce9b90c1ab7 ("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>
sound/soc/generic/audio-graph-card.c