Thread (2 messages) 2 messages, 2 authors, 4d ago

[PATCH] powerpc/opalcore: fix device node leak on incompatible dump node

flat view
COOLING4d

From: Haotian Zhang <hidden>
Date: 2026-10-08 19:06:00
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

opalcore_config_init() gets a reference on the "/ibm,opal/dump" device
node with of_find_node_by_path(), but when the node is not compatible
with "ibm,opal-dump" it warns and returns without dropping that
reference, leaking the node. Every other exit path, including the
adjacent of_get_property() failure, releases it.

Release the device node reference before returning from that error path.

Fixes: 6f713d18144c ("powerpc/opalcore: export /sys/firmware/opal/core for analysing opal crashes")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <redacted>
---
 arch/powerpc/platforms/powernv/opal-core.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
index 32662d30d70f..fbf4677e811d 100644
--- a/arch/powerpc/platforms/powernv/opal-core.c
+++ b/arch/powerpc/platforms/powernv/opal-core.c
@@ -455,6 +455,7 @@ static void __init opalcore_config_init(void)
 
 	if (!of_device_is_compatible(np, "ibm,opal-dump")) {
 		pr_warn("Support missing for this f/w version!\n");
+		of_node_put(np);
 		return;
 	}
 
-- 
2.25.1

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help