[PATCH 5/5] ASoC: rsnd: fix SSIU node reference leak in rsnd_dma_of_path
From: shao.mingyin
Date: Sat Nov 07 2026 - 03:12:01 EST
From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
rsnd_ssiu_of_node() returns the child node obtained by
of_get_child_by_name(), which holds a reference. rsnd_dma_of_path()
only tests that node and never drops the reference, so every DMA path
setup leaks the SSIU node.
Put the node after the SSIU branch has used it.
Fixes: 4e7788fb8018 ("ASoC: rsnd: add SSIU BUSIF support")
Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
---
diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c
index 793dd4adbe5c..ece23ef5e56c 100644
--- a/sound/soc/renesas/rcar/dma.c
+++ b/sound/soc/renesas/rcar/dma.c
@@ -791,6 +791,7 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,
struct rsnd_mod *mod_start, *mod_end;
struct rsnd_priv *priv = rsnd_mod_to_priv(this);
struct device *dev = rsnd_priv_to_dev(priv);
+ struct device_node *ssiu_np;
int nr, i, idx;
/*
@@ -803,13 +804,15 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,
* rsnd_ssiu_dma_req()
* rsnd_ssi_dma_req()
*/
- if (rsnd_ssiu_of_node(priv)) {
+ ssiu_np = rsnd_ssiu_of_node(priv);
+ if (ssiu_np) {
struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io);
/* use SSIU */
ssi = ssiu;
if (this == rsnd_io_to_mod_ssi(io))
this = ssiu;
+ of_node_put(ssiu_np);
} else {
/* keep compatible, use SSI */
ssi = rsnd_io_to_mod_ssi(io);