summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorWang Yufen <wangyufen@huawei.com>2022-12-05 16:15:27 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-31 13:33:06 +0100
commit4cc8431ec77a43ea106d8bde0860c61cfdda1cd0 (patch)
treea418c3cfa96a4fbca0e1a67c963e2072c4249782 /sound
parenta22cfbf78a87f0772f59920cb7370e46481369d8 (diff)
downloadlinux-4cc8431ec77a43ea106d8bde0860c61cfdda1cd0.tar.gz
linux-4cc8431ec77a43ea106d8bde0860c61cfdda1cd0.tar.bz2
linux-4cc8431ec77a43ea106d8bde0860c61cfdda1cd0.zip
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/audio-graph-card.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index fe7cf972d44c..5daa824a4ffc 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -485,8 +485,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;
}