iommu/arm-smmu: avoid possible deadlock during map_sg
A possible deadlock could occur with the following flow:
arm_smmu_map_sg()
-->arm_smmu_secure_domain_lock()
-->ops->map_sg() //this returns an error with ret = 0
-->size_to_unmap = iova + size - __saved_iova_start;
-->goto out;
-->arm_smmu_assign_table()
-->arm_smmu_unmap()
---->arm_smmu_secure_domain_lock() //DEADLOCKed!!!!!
-------->mutex_lock()
The secure domain lock is needed to protect hyp assign and unassign.
Hence, its safe to call arm_smmu_secure_domain_unlock() after the
map and assign is done. Do this to avoid any runtime deadlocks.
Change-Id: I35effc170d8432d32c0cab3081be4897830d9212
Signed-off-by:
Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Loading
Please register or sign in to comment