mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] of: unittest: fix node leak in of_dma_get_max_cpu_address test
@ 2026-11-03 10:42 Wentao Liang
  2026-11-03 11:10 ` Krzysztof Kozlowski
  2026-11-08 11:56 ` Wentao Liang
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03 10:42 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan
  Cc: devicetree, linux-kernel, Wentao Liang, stable

of_find_node_by_path() returns a device_node with its reference count
incremented. of_unittest_dma_get_max_cpu_address() passes the node to
of_dma_get_max_cpu_address(), which does not consume the reference, and
then returns without dropping it.

Release the reference after the check.

Fixes: 07d13a1d6120 ("of: unittest: Add test for of_dma_get_max_cpu_address()")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/of/unittest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index d2f5c7ef3178..8133c954d335 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1145,6 +1145,7 @@ static void __init of_unittest_dma_get_max_cpu_address(void)
 	unittest(cpu_addr == 0x4fffffff,
 		 "of_dma_get_max_cpu_address: wrong CPU addr %pad (expecting %x)\n",
 		 &cpu_addr, 0x4fffffff);
+	of_node_put(np);
 }
 
 static void __init of_unittest_dma_ranges_one(const char *path,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-08 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:42 [PATCH] of: unittest: fix node leak in of_dma_get_max_cpu_address test Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-08 11:56 ` Wentao Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®