Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its
@ 2026-07-21  6:32 Kemeng Shi
  2026-07-21  6:32 ` [PATCH v6 1/2] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kemeng Shi @ 2026-07-21  6:32 UTC (permalink / raw)
  To: maz, tglx, radu; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi

There are some random fixes and cleanups to irqchip/gic-v3-its. More
details can be found in respective patches.
Thanks.

v1->v2:
- Drop unneeded patches and some minor improvement.
v2->v3:
- Fix an extra leak issue in its_vpe_irq_domain_alloc().
- Remove redundant check in its_vpe_db_proxy_unmap_locked()
v3->v4:
- Add missing Fixes tags
- Improve changelog description
v4->v5:
- Collect RVB from Radu
- Drop more unneeded patches
- Use existing error handling to do its_vpe_teardown() in patch 3/4
v5->v6:
- Collect more RVB from Radu
- Drop first two patches which are already merged
- Add comment and do an early when vpe is not initialized in patch 1/2 
- Use single-line comment in patch 2/2

Kemeng Shi (2):
  irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
  irqchip/gic-v3-its: Fix grammar and replace a bit number with its
    symbol

 drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

-- 
2.36.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v6 1/2] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
  2026-07-21  6:32 [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Kemeng Shi
@ 2026-07-21  6:32 ` Kemeng Shi
  2026-07-21  6:32 ` [PATCH v6 2/2] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol Kemeng Shi
  2026-07-21  7:15 ` [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Marc Zyngier
  2 siblings, 0 replies; 4+ messages in thread
From: Kemeng Shi @ 2026-07-21  6:32 UTC (permalink / raw)
  To: maz, tglx, radu; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi

When its_irq_gic_domain_alloc() fails, the following
its_vpe_irq_domain_free() skips calling its_vep_teardown() for the
corresponding irq. Try its_vpe_teardown() in error handling to avoid
the leak issue.

Fixes: 7d75bbb4bc1ad ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 291d7668cc8d..28899792afd3 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -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;
 }
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v6 2/2] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol
  2026-07-21  6:32 [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Kemeng Shi
  2026-07-21  6:32 ` [PATCH v6 1/2] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
@ 2026-07-21  6:32 ` Kemeng Shi
  2026-07-21  7:15 ` [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Marc Zyngier
  2 siblings, 0 replies; 4+ messages in thread
From: Kemeng Shi @ 2026-07-21  6:32 UTC (permalink / raw)
  To: maz, tglx, radu; +Cc: linux-arm-kernel, linux-kernel, Kemeng Shi

Fix grammatical errors in comments and simplify the comment about reading
GITS_BASER_INDIRECT to check two-level support.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Radu Rendec <radu@rendec.net>
---
 drivers/irqchip/irq-gic-v3-its.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 28899792afd3..1c6a5213e779 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -163,7 +163,7 @@ struct event_lpi_map {
 
 /*
  * The ITS view of a device - belongs to an ITS, owns an interrupt
- * translation table, and a list of interrupts.  If it some of its
+ * translation table, and a list of interrupts.  If some of its
  * LPIs are injected into a guest (GICv4), the event_map.vm field
  * indicates which one.
  */
@@ -2501,10 +2501,7 @@ static bool its_parse_indirect_baser(struct its_node *its,
 
 	/* No need to enable Indirection if memory requirement < (psz*2)bytes */
 	if ((esz << ids) > (psz * 2)) {
-		/*
-		 * Find out whether hw supports a single or two-level table by
-		 * table by reading bit at offset '62' after writing '1' to it.
-		 */
+		 /* Find out whether hw supports a single or two-level table */
 		its_write_baser(its, baser, val | GITS_BASER_INDIRECT);
 		indirect = !!(baser->val & GITS_BASER_INDIRECT);
 
-- 
2.36.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its
  2026-07-21  6:32 [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Kemeng Shi
  2026-07-21  6:32 ` [PATCH v6 1/2] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
  2026-07-21  6:32 ` [PATCH v6 2/2] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol Kemeng Shi
@ 2026-07-21  7:15 ` Marc Zyngier
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2026-07-21  7:15 UTC (permalink / raw)
  To: Kemeng Shi; +Cc: tglx, radu, linux-arm-kernel, linux-kernel

On Tue, 21 Jul 2026 07:32:39 +0100,
Kemeng Shi <shikemeng@huaweicloud.com> wrote:
> 
> There are some random fixes and cleanups to irqchip/gic-v3-its. More
> details can be found in respective patches.
> Thanks.
> 
> v1->v2:
> - Drop unneeded patches and some minor improvement.
> v2->v3:
> - Fix an extra leak issue in its_vpe_irq_domain_alloc().
> - Remove redundant check in its_vpe_db_proxy_unmap_locked()
> v3->v4:
> - Add missing Fixes tags
> - Improve changelog description
> v4->v5:
> - Collect RVB from Radu
> - Drop more unneeded patches
> - Use existing error handling to do its_vpe_teardown() in patch 3/4
> v5->v6:
> - Collect more RVB from Radu
> - Drop first two patches which are already merged
> - Add comment and do an early when vpe is not initialized in patch 1/2 
> - Use single-line comment in patch 2/2
> 
> Kemeng Shi (2):
>   irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc()
>   irqchip/gic-v3-its: Fix grammar and replace a bit number with its
>     symbol
> 
>  drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-21  7:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21  6:32 [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Kemeng Shi
2026-07-21  6:32 ` [PATCH v6 1/2] irqchip/gic-v3-its: Fix leak in its_vpe_irq_domain_alloc() Kemeng Shi
2026-07-21  6:32 ` [PATCH v6 2/2] irqchip/gic-v3-its: Fix grammar and replace a bit number with its symbol Kemeng Shi
2026-07-21  7:15 ` [PATCH v6 0/2] Minor fix and cleanup to irqchip/gic-v3-its Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox