]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ARM: npcm: Fix OF node refcount leaks in SMP setup
authorYuho Choi <dbgh9129@gmail.com>
Mon, 25 May 2026 03:38:46 +0000 (23:38 -0400)
committerAndrew Jeffery <andrew@codeconstruct.com.au>
Wed, 22 Jul 2026 13:41:56 +0000 (23:11 +0930)
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.

Fixes: 7bffa14c9aed ("arm: npcm: add basic support for Nuvoton BMCs")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Reviewed-by: Avi Fishman <avifishman70@gmail.com>
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
arch/arm/mach-npcm/platsmp.c

index 41891d3aa1247d4d689ddaf20fbdae07ab0aed68..4c1fc9983746ce4227bbfbf14135bdd038ec7ec8 100644 (file)
@@ -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;