[PATCH 5/7] iommu/vt-d: Use old domain parameter when attaching the blocking domain
From: Lu Baolu
Date: Wed Sep 09 2026 - 04:13:26 EST
blocking_domain_attach_dev() drops the old domain’s iopf reference using
info->domain, but that value may already be cleared by
device_block_translation().
On attach failure fallback paths, this can cause the function to drop a
NULL-domain ref instead of @old, leaking the real old-domain reference.
Repeated leaks grow info->iopf_refcount, keep the device stuck on the
iopf queue, and can trigger WARN_ON(info->iopf_refcount) when PRI is
disabled.
Use the core-provided @old parameter directly. It always identifies the
correct domain to release and matches other attach paths.
Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 5553c57130f7..99cf6716f602 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2899,9 +2899,7 @@ static int blocking_domain_attach_dev(struct iommu_domain *domain,
struct device *dev,
struct iommu_domain *old)
{
- struct device_domain_info *info = dev_iommu_priv_get(dev);
-
- iopf_for_domain_remove(info->domain ? &info->domain->domain : NULL, dev);
+ iopf_for_domain_remove(old, dev);
device_block_translation(dev);
return 0;
}
--
2.43.0