From: Miaoqian Lin <linmq006@gmail.com>
To: Scott Wood <oss@buserror.net>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Miaoqian Lin <linmq006@gmail.com>,
Trent Piepho <tpiepho@freescale.com>,
Kumar Gala <galak@kernel.crashing.org>,
Andy Fleming <afleming@freescale.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH] powerpc/85xx: Fix device node leaks
Date: Thu, 11 Dec 2025 17:00:10 +0400 [thread overview]
Message-ID: <20251211130012.2404862-1-linmq006@gmail.com> (raw)
Add missing of_node_put() calls for device-tree nodes returned by
of_find_node_by_type() and of_get_cpu_node() to avoid leaking DT
node references.
Found via static analysis and code review.
Fixes: d5b26db2cfcf ("powerpc/85xx: Add support for SMP initialization")
Fixes: 563fdd4a0af5 ("powerpc/85xx: Update smp support to handle doorbells and non-mpic init")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
arch/powerpc/platforms/85xx/smp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 32fa5fb557c0..cc5bf097c26f 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -199,6 +199,7 @@ static int smp_85xx_start_cpu(int cpu)
cpu_rel_addr = of_get_property(np, "cpu-release-addr", NULL);
if (!cpu_rel_addr) {
pr_err("No cpu-release-addr for cpu %d\n", cpu);
+ of_node_put(np);
return -ENOENT;
}
@@ -217,6 +218,8 @@ static int smp_85xx_start_cpu(int cpu)
else
spin_table = phys_to_virt(*cpu_rel_addr);
+ of_node_put(np);
+
local_irq_save(flags);
hard_irq_disable();
@@ -485,6 +488,7 @@ void __init mpc85xx_smp_init(void)
smp_85xx_ops.probe = smp_mpic_probe;
smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
smp_85xx_ops.message_pass = smp_mpic_message_pass;
+ of_node_put(np);
} else
smp_85xx_ops.setup_cpu = NULL;
--
2.25.1
reply other threads:[~2025-12-11 13:00 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=20251211130012.2404862-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=afleming@freescale.com \
--cc=chleroy@kernel.org \
--cc=galak@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oss@buserror.net \
--cc=stable@vger.kernel.org \
--cc=tpiepho@freescale.com \
/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®