]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ARM: socfpga: Fix OF node refcount leak in SMP setup
authorYuho Choi <dbgh9129@gmail.com>
Mon, 25 May 2026 02:47:09 +0000 (22:47 -0400)
committerDinh Nguyen <dinguyen@kernel.org>
Tue, 26 May 2026 14:53:20 +0000 (09:53 -0500)
socfpga_smp_prepare_cpus() looks up the Cortex-A9 SCU node with
of_find_compatible_node(), which returns a node reference that must be
released with of_node_put().

The function maps the SCU registers and then returns without dropping
that reference, leaking the node on both the success path and the
of_iomap() failure path.

Drop the reference once the mapping attempt is complete. The returned
MMIO mapping does not depend on keeping the device node reference held.

Fixes: 122694a0c712 ("ARM: socfpga: use of_iomap to map the SCU")
Cc: stable@vger.kernel.org
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
arch/arm/mach-socfpga/platsmp.c

index 201191cf68f324ca970e93162d46500214b449a5..349e6c54518e5da44860b89e4b1e95a7a19a8d1f 100644 (file)
@@ -78,6 +78,7 @@ static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
        }
 
        socfpga_scu_base_addr = of_iomap(np, 0);
+       of_node_put(np);
        if (!socfpga_scu_base_addr)
                return;
        scu_enable(socfpga_scu_base_addr);