mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: alpine: fix device_node refcount leak in alpine_cpu_pm_init()
@ 2026-09-26  4:23 Weigang He
  0 siblings, 0 replies; only message in thread
From: Weigang He @ 2026-09-26  4:23 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: Arnd Bergmann, Russell King, linux-arm-kernel, linux-kernel, Weigang He

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@gmail.com>
---

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-26  4:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-26  4:23 [PATCH] ARM: alpine: fix device_node refcount leak in alpine_cpu_pm_init() Weigang He

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®