[PATCH v7 3/5] iommu/arm-smmu-v3: Fix a UAF in the probe_device error path

From: Pranjal Shrivastava

Date: Mon Jun 01 2026 - 10:41:21 EST


Clear the iommu->priv to NULL while returning an error from probe_device.

Fixes: a2be6218e649 ("iommu/arm-smmu-v3: Improve add_device() error handling")
Signed-off-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index a10affb483a4..54c7f1ae3a84 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -4206,6 +4206,7 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev)
arm_smmu_disable_pasid(master);
arm_smmu_remove_master(master);
err_free_master:
+ dev_iommu_priv_set(dev, NULL);
kfree(master);
return ERR_PTR(ret);
}
--
2.54.0.823.g6e5bcc1fc9-goog