Skip to content

Commit

Permalink
irqchip/gic-v3-its: Fix potential VPE leak on error
Browse files Browse the repository at this point in the history
[ Upstream commit 280bef5 ]

In its_vpe_irq_domain_alloc, when its_vpe_init() returns an error,
there is an off-by-one in the number of VPEs to be freed.

Fix it by simply passing the number of VPEs allocated, which is the
index of the loop iterating over the VPEs.

Fixes: 7d75bbb ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
Signed-off-by: Kaige Fu <kaige.fu@linux.alibaba.com>
[maz: fixed commit message]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/d9e36dee512e63670287ed9eff884a5d8d6d27f2.1631672311.git.kaige.fu@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Kaige Fu authored and gregkh committed Sep 30, 2021
1 parent 5468867 commit e0c1c2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic-v3-its.c
Expand Up @@ -4501,7 +4501,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq

if (err) {
if (i > 0)
its_vpe_irq_domain_free(domain, virq, i - 1);
its_vpe_irq_domain_free(domain, virq, i);

its_lpi_free(bitmap, base, nr_ids);
its_free_prop_table(vprop_page);
Expand Down

0 comments on commit e0c1c2e

Please sign in to comment.