ARM: npcm: Fix OF node refcount leaks in SMP setup
Subsystems (3)
PATCH 1/1 ARM: npcm: Fix OF node refcount leaks in SMP setup
npcm7xx_smp_boot_secondary() and npcm7xx_smp_prepare_cpus() look up the GCR and SCU nodes with of_find_compatible_node(). The returned nodes are used for of_iomap(), but the node references are never released.
of_iomap() does not consume the device node reference, and iounmap() only releases the MMIO mapping. Drop each node reference after the corresponding mapping attempt.
--- arch/arm/mach-npcm/platsmp.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-npcm/platsmp.c +2 -0
@@ -32,6 +32,7 @@ static int npcm7xx_smp_boot_secondary(unsigned int cpu, goto out; } gcr_base =of_iomap (gcr_np,0 ); +of_node_put (gcr_np);if (!gcr_base) {pr_err ("could not iomap gcr" ); ret = -ENOMEM ;
@@ -60,6 +61,7 @@ static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus)return ; } scu_base =of_iomap (scu_np,0 ); +of_node_put (scu_np);if (!scu_base) {pr_err ("could not iomap scu" );return ;
Signature · 1 line
2.43.0
Hi,
Just a gentle ping on this patch.
I would appreciate any feedback when you have a chance to review this.
Thanks
Andrew Jeffery
maintainerQuoted 10 lines · Yuho Choi
npcm7xx_smp_boot_secondary()andnpcm7xx_smp_prepare_cpus()look up the GCR and SCU nodes withof_find_compatible_node(). The returned nodes are used forof_iomap(), but the node references are never released.
of_iomap()does not consume the device node reference, andiounmap()only releases the MMIO mapping. Drop each node reference after the corresponding mapping attempt.[...]
Thanks, I've applied this to the BMC tree.
Signature · 1 line
Andrew Jeffery <[email protected]>