* [PATCH] irqchip/gic-v3-its: Fix potential vpe leak
@ 2021-09-15 2:20 Kaige Fu
2021-09-22 1:17 ` Kaige Fu
0 siblings, 1 reply; 2+ messages in thread
From: Kaige Fu @ 2021-09-15 2:20 UTC (permalink / raw)
To: linux-kernel; +Cc: tglx, maz, shannon.zhao, Kaige Fu
In its_vpe_irq_domain_alloc, when there is error calling its_vpe_init
with vm->vpes[i], it says that the number of vpes which has been
initialized are 'i'. So, the correct value passed to
its_vpe_irq_domain_free should be 'i' instead of 'i - 1' because
its_vpe_irq_domain_free takes nr_irqs as its third parameter.
If we pass the 'i - 1' to its_vpe_irq_domain_free, the vpe[i - 1] will
be leaked. This patch fixes it.
Fixes: 7d75bbb4bc1a ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
Signed-off-by: Kaige Fu <kaige.fu@linux.alibaba.com>
---
drivers/irqchip/irq-gic-v3-its.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 7f40dca8cda5..eb0882d15366 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] irqchip/gic-v3-its: Fix potential vpe leak
2021-09-15 2:20 [PATCH] irqchip/gic-v3-its: Fix potential vpe leak Kaige Fu
@ 2021-09-22 1:17 ` Kaige Fu
0 siblings, 0 replies; 2+ messages in thread
From: Kaige Fu @ 2021-09-22 1:17 UTC (permalink / raw)
To: linux-kernel; +Cc: tglx, maz, shannon.zhao
Ping ...
在 2021/9/15 上午10:20, Kaige Fu 写道:
> In its_vpe_irq_domain_alloc, when there is error calling its_vpe_init
> with vm->vpes[i], it says that the number of vpes which has been
> initialized are 'i'. So, the correct value passed to
> its_vpe_irq_domain_free should be 'i' instead of 'i - 1' because
> its_vpe_irq_domain_free takes nr_irqs as its third parameter.
>
> If we pass the 'i - 1' to its_vpe_irq_domain_free, the vpe[i - 1] will
> be leaked. This patch fixes it.
>
> Fixes: 7d75bbb4bc1a ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
> Signed-off-by: Kaige Fu <kaige.fu@linux.alibaba.com>
> ---
> drivers/irqchip/irq-gic-v3-its.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 7f40dca8cda5..eb0882d15366 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-22 1:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 2:20 [PATCH] irqchip/gic-v3-its: Fix potential vpe leak Kaige Fu
2021-09-22 1:17 ` Kaige Fu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).