]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iommu/arm-smmu: Check that iommu_fwspecs are ours
authorRobin Murphy <robin.murphy@arm.com>
Wed, 2 Nov 2016 17:31:32 +0000 (17:31 +0000)
committerJoerg Roedel <jroedel@suse.de>
Tue, 8 Nov 2016 13:46:41 +0000 (14:46 +0100)
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: 765771ed4bcb ("iommu/arm-smmu: Wire up generic configuration support")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/arm-smmu.c

index 3af7f8f62d0adfa4cd6b0e16630585058795cc4c..d388629ab9904da1f1f2e447277a387ac3273eee 100644 (file)
@@ -1400,7 +1400,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;