提交 d3bca166 编写于 作者: W Will Deacon

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: NWill Deacon <will.deacon@arm.com>
上级 9c5c92e3
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册