From e9f7462305a391532260a6c9e6ec1d23b6073a7c Mon Sep 17 00:00:00 2001 From: Neeti Desai Date: Wed, 19 Aug 2015 15:19:25 -0700 Subject: [PATCH] iommu/arm-smmu: Pass the correct size to be unmapped For all but the last level of the page tables, we need to call unmap with supported IOMMU pages sizes. However currently to get the maximum page size that can be unmapped, we are passing the original size parameter, instead of the remaining size to be unmapped, and that can end up unmapping more than what is intended. Fix this by passing the remaining size parameter to find the correct IOMMU page size. Change-Id: Id4bd188ff6a3b4b7d34ba43ae6a61efb3c65b281 Signed-off-by: Neeti Desai --- drivers/iommu/io-pgtable-arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 582e858c8cad..83cd01d80617 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -711,7 +711,8 @@ static size_t arm_lpae_unmap(struct io_pgtable_ops *ops, unsigned long iova, remaining = (size - unmapped); size_to_unmap = remaining < SZ_2M ? remaining - : iommu_pgsize(data->iop.cfg.pgsize_bitmap, iova, size); + : iommu_pgsize(data->iop.cfg.pgsize_bitmap, iova, + remaining); ret = __arm_lpae_unmap(data, iova, size_to_unmap, lvl, ptep, NULL); if (ret == 0)