Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64e19d89 authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Matt Wagantall
Browse files

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: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 77ce2003
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
}