[PATCH] ARM: alpine: fix device_node refcount leak in alpine_cpu_pm_init()
From: Weigang He
Date: Sat Sep 26 2026 - 00:24:20 EST
of_find_compatible_node() returns the matching device_node with its
refcount incremented; the caller must drop it with of_node_put().
alpine_cpu_pm_init() obtains the "al,alpine-cpu-resume" node, maps it
with of_iomap() and never releases the reference. The function is
__init and runs once, so this is a one-shot leak of a single refcount
during boot, with no functional impact.
Drop the reference after of_iomap(), which does not retain it; np is
not used afterwards.
Found by static analysis tool CodeQL.
Fixes: e9e06f2853dd ("ARM: Alpine: smp support")
Assisted-by: LLM codeql
Signed-off-by: Weigang He <geoffreyhe2@xxxxxxxxx>
---
Notes:
Compile-tested only (ARCH=arm multi_v7_defconfig, W=1). Not tested on
hardware; I have no Alpine board.
The CodeQL query behind this report was synthesized with LLM assistance,
and the fix and changelog were drafted with LLM assistance; I have
reviewed them.
arch/arm/mach-alpine/alpine_cpu_pm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-alpine/alpine_cpu_pm.c b/arch/arm/mach-alpine/alpine_cpu_pm.c
index b48da6f12b6cc..332c3c00d3680 100644
--- a/arch/arm/mach-alpine/alpine_cpu_pm.c
+++ b/arch/arm/mach-alpine/alpine_cpu_pm.c
@@ -50,6 +50,7 @@ void __init alpine_cpu_pm_init(void)
np = of_find_compatible_node(NULL, NULL, "al,alpine-cpu-resume");
al_cpu_resume_regs = of_iomap(np, 0);
+ of_node_put(np);
wakeup_supported = !IS_ERR(al_sysfabric) && al_cpu_resume_regs;
base-commit: 165768bb70265b5c38cf0b73fafd75be235f8b14
prerequisite-patch-id: c5a3be8688fd8e88a00352acb1374e91fcb52a03
prerequisite-patch-id: 67693e2c08624df0841619cc085ce9200f4385fc
--
2.43.0