mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
iommu: msm: prevent partial mappings on error
If msm_iommu_map_range() fails mid way through the va range with an error, clean up the PTEs that have already been created so they are not leaked. Change-Id: Ie929343cd6e36cade7b2cc9b4b4408c3453e6b5f CRs-Fixed: 478304 Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
This commit is contained in:
parent
69cd952800
commit
9dac5e5da3
2 changed files with 7 additions and 0 deletions
|
@ -50,6 +50,9 @@ __asm__ __volatile__ ( \
|
|||
#define MSM_IOMMU_ATTR_CACHED_WT 0x3
|
||||
|
||||
|
||||
static int msm_iommu_unmap_range(struct iommu_domain *domain, unsigned int va,
|
||||
unsigned int len);
|
||||
|
||||
static int msm_iommu_unmap_range(struct iommu_domain *domain, unsigned int va,
|
||||
unsigned int len);
|
||||
|
||||
|
|
|
@ -430,6 +430,7 @@ int msm_iommu_pagetable_map_range(struct iommu_pt *pt, unsigned int va,
|
|||
struct scatterlist *sg, unsigned int len, int prot)
|
||||
{
|
||||
phys_addr_t pa;
|
||||
unsigned int start_va = va;
|
||||
unsigned int offset = 0;
|
||||
unsigned long *fl_pte;
|
||||
unsigned long fl_offset;
|
||||
|
@ -556,6 +557,9 @@ int msm_iommu_pagetable_map_range(struct iommu_pt *pt, unsigned int va,
|
|||
}
|
||||
|
||||
fail:
|
||||
if (ret && offset > 0)
|
||||
msm_iommu_pagetable_unmap_range(pt, start_va, offset);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue