Skip to content

Commit 8ab2d12

Browse files
wangyufen316broonie
authored andcommitted
ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link()
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 <[email protected]> Acked-by: Kuninori Morimoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3327d72 commit 8ab2d12

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/soc/generic/audio-graph-card.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv,
485485
of_node_put(codec_ep);
486486
of_node_put(codec_port);
487487

488-
if (ret < 0)
488+
if (ret < 0) {
489+
of_node_put(cpu_ep);
489490
return ret;
491+
}
490492

491493
codec_port_old = codec_port;
492494
}

0 commit comments

Comments
 (0)