summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-11 21:15:51 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-11 21:15:51 +0300
commit7d7a827ba92c4a1a29fb1d0812db503e80cf3a59 (patch)
treee756633f7a3c82d6fdd1731c2a0c66531b1f7d3c
parent8001a975f955f532d8d0c27b224d58646e202f2a (diff)
parenta7990c647b35415e3dd07a077480a908678947ba (diff)
downloadlinux-7d7a827ba92c4a1a29fb1d0812db503e80cf3a59.tar.xz
Merge tag 'iommu-fixes-v4.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU fix from Joerg Roedel: "Fix a NULL-pointer dereference in arm_smmu_add_device" * tag 'iommu-fixes-v4.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device
-rw-r--r--drivers/iommu/arm-smmu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index b97188acc4f1..2d80fa8a0634 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1519,6 +1519,13 @@ static int arm_smmu_add_device(struct device *dev)
if (using_legacy_binding) {
ret = arm_smmu_register_legacy_master(dev, &smmu);
+
+ /*
+ * If dev->iommu_fwspec is initally NULL, arm_smmu_register_legacy_master()
+ * will allocate/initialise a new one. Thus we need to update fwspec for
+ * later use.
+ */
+ fwspec = dev->iommu_fwspec;
if (ret)
goto out_free;
} else if (fwspec && fwspec->ops == &arm_smmu_ops) {