mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Weigang He <geoffreyhe2@gmail.com>
To: Antoine Tenart <atenart@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Weigang He <geoffreyhe2@gmail.com>
Subject: [PATCH] ARM: alpine: fix device_node refcount leak in alpine_cpu_pm_init()
Date: Sat, 26 Sep 2026 14:23:32 +1000	[thread overview]
Message-ID: <20260926042332.1633698-1-geoffreyhe2@gmail.com> (raw)

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


                 reply	other threads:[~2026-09-26  4:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260926042332.1633698-1-geoffreyhe2@gmail.com \
    --to=geoffreyhe2@gmail.com \
    --cc=arnd@arndb.de \
    --cc=atenart@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®