[PATCH v3 09/14] irqchip/gic-v5: Invalidate ITS device cache before freeing ITT

From: Sascha Bischoff

Date: Wed Nov 18 2026 - 12:36:44 EST


A cached device table entry can still reference the ITT after its
memory is freed via kfree(), even if the DTE has been marked as
invalid. Once the memory has been released, it could be reallocated,
and it would be unfortunate for the hardware to interpret this as a
valid ITT.

Invalidate the device cache and wait for completion before freeing the
ITT during device teardown.

Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
Signed-off-by: Sascha Bischoff <sascha.bischoff@xxxxxxx>
Acked-by: Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
drivers/irqchip/irq-gic-v5-its.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
index 876437017ccc5..dce5bfd1a78dd 100644
--- a/drivers/irqchip/irq-gic-v5-its.c
+++ b/drivers/irqchip/irq-gic-v5-its.c
@@ -556,6 +556,7 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
struct gicv5_its_dev *its_dev)
{
__le64 *dte;
+ int ret;

dte = gicv5_its_devtab_get_dte_ref(its, its_dev->device_id, false);

@@ -568,9 +569,10 @@ static int gicv5_its_device_unregister(struct gicv5_its_chip_data *its,
/* Zero everything - make it clear that this is an invalid entry */
its_write_table_entry(its, dte, 0);

+ ret = gicv5_its_device_cache_inv(its, its_dev);
gicv5_its_free_itt(its_dev);

- return gicv5_its_device_cache_inv(its, its_dev);
+ return ret;
}

/*

--
2.34.1