mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
irqchip/gic-v3-its: Prevent leak in its_vpe_irq_domain_alloc()
When its_irq_gic_domain_alloc() fails, the following
its_vpe_irq_domain_free() fails to invoke its_vep_teardown() for the
corresponding interrupt, which leaks the resource.
Invoke its_vpe_teardown() in the error handling path to avoid the leak.
[ tglx: Massaged change log ]
Fixes: 7d75bbb4bc ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://patch.msgid.link/20260721063241.52549-2-shikemeng@huaweicloud.com
This commit is contained in:
parent
616dd89d81
commit
325ff3e78c
|
|
@ -4594,6 +4594,13 @@ static int its_vpe_init(struct its_vpe *vpe)
|
|||
|
||||
static void its_vpe_teardown(struct its_vpe *vpe)
|
||||
{
|
||||
/*
|
||||
* If vpt_page is NULL, then its_vpe_init() has failed, and
|
||||
* there is nothing to do as no resource has been allocated.
|
||||
*/
|
||||
if (vpe->vpt_page == NULL)
|
||||
return;
|
||||
|
||||
its_vpe_db_proxy_unmap(vpe);
|
||||
its_vpe_id_free(vpe->vpe_id);
|
||||
its_free_pending_table(vpe->vpt_page);
|
||||
|
|
@ -4674,8 +4681,10 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
|
|||
irqd_set_resend_when_in_progress(irq_get_irq_data(virq + i));
|
||||
}
|
||||
|
||||
if (err)
|
||||
if (err) {
|
||||
its_vpe_teardown(vm->vpes[i]);
|
||||
its_vpe_irq_domain_free(domain, virq, i);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user