diff options
author | Will Deacon <will.deacon@arm.com> | 2014-07-04 06:06:01 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-07-04 08:16:05 -0400 |
commit | d3bca16635ae7443139c4408def7c1a50755083f (patch) | |
tree | e88a4f7b1fca963cd350631aeb447694cc7b49fb | |
parent | 9c5c92e35cf5c4f7ee523d62a6bf9d5dc290350b (diff) |
iommu/arm-smmu: fix capability checking prior to device attach
If somebody attempts to check the capability of an IOMMU domain prior to
device attach, then we'll try to dereference a NULL SMMU pointer through
the SMMU domain (since we can't determine the actual SMMU instance until
we have a device attached).
This patch fixes the capability check so that non-global features are
reported as being absent when no device is attached to the domain.
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | drivers/iommu/arm-smmu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 7638b579e08d..5496de58fc3b 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -1509,7 +1509,8 @@ static int arm_smmu_domain_has_cap(struct iommu_domain *domain, | |||
1509 | unsigned long cap) | 1509 | unsigned long cap) |
1510 | { | 1510 | { |
1511 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1511 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1512 | u32 features = smmu_domain->smmu->features; | 1512 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
1513 | u32 features = smmu ? smmu->features : 0; | ||
1513 | 1514 | ||
1514 | switch (cap) { | 1515 | switch (cap) { |
1515 | case IOMMU_CAP_CACHE_COHERENCY: | 1516 | case IOMMU_CAP_CACHE_COHERENCY: |