mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kaige Fu <kaige.fu@linux.alibaba.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, maz@kernel.org,
	shannon.zhao@linux.alibaba.com,
	Kaige Fu <kaige.fu@linux.alibaba.com>
Subject: [PATCH] irqchip/gic-v3-its: Fix potential vpe leak
Date: Wed, 15 Sep 2021 10:20:55 +0800	[thread overview]
Message-ID: <d9e36dee512e63670287ed9eff884a5d8d6d27f2.1631672311.git.kaige.fu@linux.alibaba.com> (raw)

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


             reply	other threads:[~2021-09-15  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  2:20 Kaige Fu [this message]
2021-09-22  1:17 ` Kaige Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9e36dee512e63670287ed9eff884a5d8d6d27f2.1631672311.git.kaige.fu@linux.alibaba.com \
    --to=kaige.fu@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=shannon.zhao@linux.alibaba.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®