Skip to content

Commit 229f733

Browse files
committed
irqchip/gic-v3-its: Prevent double free on error
jira LE-1907 cve CVE-2024-35847 Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 commit-author Guanrui Huang <[email protected]> commit c26591a 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] (cherry picked from commit c26591a) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 39bbb0b commit 229f733

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
@@ -4500,13 +4500,8 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
45004500
set_bit(i, bitmap);
45014501
}
45024502

4503-
if (err) {
4504-
if (i > 0)
4505-
its_vpe_irq_domain_free(domain, virq, i);
4506-
4507-
its_lpi_free(bitmap, base, nr_ids);
4508-
its_free_prop_table(vprop_page);
4509-
}
4503+
if (err)
4504+
its_vpe_irq_domain_free(domain, virq, i);
45104505

45114506
return err;
45124507
}

0 commit comments

Comments
 (0)