[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251211130012.2404862-1-linmq006@gmail.com>
Date: Thu, 11 Dec 2025 17:00:10 +0400
From: Miaoqian Lin <linmq006@...il.com>
To: Scott Wood <oss@...error.net>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
"Christophe Leroy (CS GROUP)" <chleroy@...nel.org>,
Miaoqian Lin <linmq006@...il.com>,
Trent Piepho <tpiepho@...escale.com>,
Kumar Gala <galak@...nel.crashing.org>,
Andy Fleming <afleming@...escale.com>,
linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Cc: stable@...r.kernel.org
Subject: [PATCH] powerpc/85xx: Fix device node leaks
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@...r.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@...il.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
Powered by blists - more mailing lists