mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
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>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
89f8099d56
commit
92b97fee78
1 changed files with 1 additions and 1 deletions
|
|
@ -3046,12 +3046,12 @@ static size_t arm_smmu_map_sg(struct iommu_domain *domain, unsigned long iova,
|
|||
|
||||
out:
|
||||
arm_smmu_assign_table(smmu_domain);
|
||||
arm_smmu_secure_domain_unlock(smmu_domain);
|
||||
|
||||
if (size_to_unmap) {
|
||||
arm_smmu_unmap(domain, __saved_iova_start, size_to_unmap, NULL);
|
||||
iova = __saved_iova_start;
|
||||
}
|
||||
arm_smmu_secure_domain_unlock(smmu_domain);
|
||||
return iova - __saved_iova_start;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue