powerpc/85xx: Fix device node leaks
Subsystems (3)
PATCH 1/1 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")
Signed-off-by Miaoqian Lin <[email protected]>
--- arch/powerpc/platforms/85xx/smp.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/85xx/smp.c +4 -0
@@ -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 ;
Signature · 1 line
2.25.1