Skip to contentSkip to conversation

iommu/arm-smmu: Check that iommu_fwspecs are ours

PATCH New Robin Murphy 2 participants 2 messages Nov 2, 2016 – Nov 3, 2016 IOMMU

lore
Share & tools
lore

Robin Murphy

author reviewer
#0 lore raw

PATCH 1/1 iommu/arm-smmu: Check that iommu_fwspecs are ours

We seem to have forgotten to check that iommu_fwspecs actually belong to us before we go ahead and dereference their private data. Oops.

Fixes 021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
---
 drivers/iommu/arm-smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm-smmu.c +1 -1
index ef978db2bb54..ef0f8d635a3b 100644
@@ -1390,7 +1390,7 @@ static int arm_smmu_add_device(struct device *dev)
 		fwspec = dev->iommu_fwspec;
 		if (ret)
 			goto out_free;
-	} else if (fwspec) {
+	} else if (fwspec && fwspec->ops == &arm_smmu_ops) {
 		smmu = arm_smmu_get_by_node(to_of_node(fwspec->iommu_fwnode));
 	} else {
 		return -ENODEV;
Signature · 1 line
2.10.2.dirty
maintainer Applied
#1 lore raw

PATCH 1/1 iommu/arm-smmu: Check that iommu_fwspecs are ours

Quoted 8 lines · Robin Murphy

We seem to have forgotten to check that iommu_fwspecs actually belong to us before we go ahead and dereference their private data. Oops.

Fixes 021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
---
 drivers/iommu/arm-smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)a

Applied to iommu/fixes, thanks.