[PATCH] soc: ti: knav_dma: Fix device node leak in of_channel_match_helper()
From: zhaofeng2
Date: Tue Nov 10 2026 - 05:22:03 EST
From: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
of_channel_match_helper() resolves the "ti,navigator-dmas" phandle
with of_parse_phandle_with_fixed_args() to obtain the channel number,
which takes a reference on the dma device node in args.np, but the
reference is never dropped after the channel number has been read
from args.args[0], so the dma node is leaked on every channel open.
Drop the reference once the channel number has been retrieved. The
phandle stored in dma_node is deliberately kept, as its ->name string
is handed out through *dma_instance and compared against later in
knav_dma_open_channel().
Fixes: 88139ed03058 ("soc: ti: add Keystone Navigator DMA support")
Signed-off-by: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
---
drivers/soc/ti/knav_dma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
--- a/drivers/soc/ti/knav_dma.c
+++ b/drivers/soc/ti/knav_dma.c
@@ -387,6 +387,8 @@
return -ENODEV;
}
+ of_node_put(args.np);
+
return args.args[0];
}