The map* in smmu_map_prop points to the dma_iommu_mapping
which was destroyed. It may be possible that a client which registers
to this swgroup will be using the stale pointer and not create one
new dma_iommu_mapping * if this pointer is not set NULL.
Fix it by setting it NULL just before domain is destroyed.
Bug
200031739
Change-Id: I05ac3456074d6bbfe11cbc766e47de257d0e0ae5
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/552080
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
struct smmu_as *as = domain_to_as(domain, -1);
struct smmu_device *smmu;
unsigned long flags;
+ struct smmu_map_prop *prop;
if (!as)
return;
smmu = as->smmu;
+ /* find the smmu_map_prop containing this domain */
+ list_for_each_entry(prop, &smmu_handle->asprops, list) {
+ if (prop->map->domain == domain)
+ goto found;
+ }
+
+ prop = NULL;
+found:
spin_lock_irqsave(&as->lock, flags);
debugfs_remove_recursive(as->debugfs_root);
devm_kfree(smmu->dev, domain->priv);
domain->priv = NULL;
+ if (prop)
+ prop->map = NULL;
dev_dbg(smmu->dev, "smmu_as@%p\n", as);
}