Skip to content

Commit c5af2c9

Browse files
Ma KeKAGA-KOKO
authored andcommitted
irqchip/gic-v2m: Fix refcount leak in gicv2m_of_init()
gicv2m_of_init() fails to perform an of_node_put() when of_address_to_resource() fails, leading to a refcount leak. Address this by moving the error handling path outside of the loop and making it common to all failure modes. Fixes: 4266ab1 ("irqchip/gic-v2m: Refactor to prepare for ACPI support") Signed-off-by: Ma Ke <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected]
1 parent efe81b7 commit c5af2c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/irqchip/irq-gic-v2m.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,12 @@ static int __init gicv2m_of_init(struct fwnode_handle *parent_handle,
407407

408408
ret = gicv2m_init_one(&child->fwnode, spi_start, nr_spis,
409409
&res, 0);
410-
if (ret) {
411-
of_node_put(child);
410+
if (ret)
412411
break;
413-
}
414412
}
415413

414+
if (ret && child)
415+
of_node_put(child);
416416
if (!ret)
417417
ret = gicv2m_allocate_domains(parent);
418418
if (ret)

0 commit comments

Comments
 (0)