summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-05-26 19:26:38 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:12:46 -0700
commit85e70599b1508526f2ac314dbeeb76e7981a12f5 (patch)
tree687d6f8809014cf01ea1213940355a7d0d2ca939
parent44fba0eb33f0cf1064e18f58db7b9a6bfed3b4a9 (diff)
iommu: io-pgtable-arm: unmap correct addresses in error path
If something bad happens in arm_lpae_map_sg we try to clean up after ourselves by unmapping any partial mappings that succeeded. However, we're currently passing in the wrong iova to the unmap function during the cleanup. Fix this. Change-Id: Ieb30616141f3fb709d02abd147f9f598e2db07cc Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--drivers/iommu/io-pgtable-arm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index a2fcc997d657..07500ca51a62 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -341,6 +341,7 @@ static int arm_lpae_map_sg(struct io_pgtable_ops *ops, unsigned long iova,
size_t mapped = 0;
int i, ret;
unsigned int min_pagesz;
+ unsigned long orig_iova = iova;
/* If no access, then nothing to do */
if (!(iommu_prot & (IOMMU_READ | IOMMU_WRITE)))
@@ -383,7 +384,7 @@ static int arm_lpae_map_sg(struct io_pgtable_ops *ops, unsigned long iova,
out_err:
/* undo mappings already done */
if (mapped)
- ops->unmap(ops, iova, mapped);
+ ops->unmap(ops, orig_iova, mapped);
return 0;
}