[tip: irq/drivers] irqchip/gic-v3-its: Free the page when gen_pool_add() fails
From: tip-bot2 for Fuad Tabba
Date: Tue Dec 01 2026 - 15:15:34 EST
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 67306fd91ba9bc8cadb66c154bb9f0658734a57b
Gitweb: https://git.kernel.org/tip/67306fd91ba9bc8cadb66c154bb9f0658734a57b
Author: Fuad Tabba <fuad.tabba@xxxxxxxxx>
AuthorDate: Mon, 30 Nov 2026 08:08:56
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Tue, 01 Dec 2026 21:12:23 +01:00
irqchip/gic-v3-its: Free the page when gen_pool_add() fails
When the ITT pool has no room, itt_alloc_pool() grows it by a page and
retries. gen_pool_add() fails when it cannot allocate its chunk
descriptor, but its return is ignored, so the page is leaked and the
retry allocates another page to leak, until an add succeeds or a page
allocation fails.
Free the page and fail the allocation instead.
Fixes: b08e2f42e86b5 ("irqchip/gic-v3-its: Share ITS tables with a non-trusted hypervisor")
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Reviewed-by: Zenghui Yu <yuzenghui@xxxxxxxxxx>
Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx>
Link: https://patch.msgid.link/20261130080856.636755-6-fuad.tabba@xxxxxxxxx
---
drivers/irqchip/irq-gic-v3-its.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 9a1b8da..dc78214 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -279,7 +279,10 @@ static void *itt_alloc_pool(int node, int size)
if (!page)
break;
- gen_pool_add(itt_pool, (unsigned long)page_address(page), PAGE_SIZE, node);
+ if (gen_pool_add(itt_pool, (unsigned long)page_address(page), PAGE_SIZE, node)) {
+ its_free_pages(page_address(page), 0);
+ break;
+ }
} while (!addr);
return (void *)addr;