Skip to content

Commit

Permalink
iommu/arm-smmu: fix capability checking prior to device attach
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Will Deacon committed Jul 4, 2014
1 parent 9c5c92e commit d3bca16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iommu/arm-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,8 @@ static int arm_smmu_domain_has_cap(struct iommu_domain *domain,
unsigned long cap)
{
struct arm_smmu_domain *smmu_domain = domain->priv;
u32 features = smmu_domain->smmu->features;
struct arm_smmu_device *smmu = smmu_domain->smmu;
u32 features = smmu ? smmu->features : 0;

switch (cap) {
case IOMMU_CAP_CACHE_COHERENCY:
Expand Down

0 comments on commit d3bca16

Please sign in to comment.