Skip to content

Commit 5dbdbe1

Browse files
Guanrui Huanggregkh
Guanrui Huang
authored andcommitted
irqchip/gic-v3-its: Prevent double free on error
commit c26591a upstream. The error handling path in its_vpe_irq_domain_alloc() causes a double free when its_vpe_init() fails after successfully allocating at least one interrupt. This happens because its_vpe_irq_domain_free() frees the interrupts along with the area bitmap and the vprop_page and its_vpe_irq_domain_alloc() subsequently frees the area bitmap and the vprop_page again. Fix this by unconditionally invoking its_vpe_irq_domain_free() which handles all cases correctly and by removing the bitmap/vprop_page freeing from its_vpe_irq_domain_alloc(). [ tglx: Massaged change log ] Fixes: 7d75bbb ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown") Signed-off-by: Guanrui Huang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9d0580d commit 5dbdbe1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4530,13 +4530,8 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
45304530
set_bit(i, bitmap);
45314531
}
45324532

4533-
if (err) {
4534-
if (i > 0)
4535-
its_vpe_irq_domain_free(domain, virq, i);
4536-
4537-
its_lpi_free(bitmap, base, nr_ids);
4538-
its_free_prop_table(vprop_page);
4539-
}
4533+
if (err)
4534+
its_vpe_irq_domain_free(domain, virq, i);
45404535

45414536
return err;
45424537
}

0 commit comments

Comments
 (0)