Skip to content

Commit

Permalink
irqchip/gic-v2m: Fix refcount leak in gicv2m_of_init()
Browse files Browse the repository at this point in the history
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 <make24@iscas.ac.cn>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240820092843.1219933-1-make24@iscas.ac.cn
  • Loading branch information
Ma Ke authored and Thomas Gleixner committed Aug 20, 2024
1 parent efe81b7 commit c5af2c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/irqchip/irq-gic-v2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ static int __init gicv2m_of_init(struct fwnode_handle *parent_handle,

ret = gicv2m_init_one(&child->fwnode, spi_start, nr_spis,
&res, 0);
if (ret) {
of_node_put(child);
if (ret)
break;
}
}

if (ret && child)
of_node_put(child);
if (!ret)
ret = gicv2m_allocate_domains(parent);
if (ret)
Expand Down

0 comments on commit c5af2c9

Please sign in to comment.