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

Commit 6ec90cf9 authored by Zhenhua Huang's avatar Zhenhua Huang
Browse files

mm: arm: Fix BUG() while do iova range checking



This BUG() is triggered when addr + size(like 0x80000000 + 0x80000000)
overflows to 0. It is the implementation only on ARM32.
Hence fix it by decreasing 1 on both sides.
By the way, adding the checking of overflow addr + size to avoid BUG()
in this case.

Change-Id: I1955fa69cd494bdde24f9dbe32879973d65d6fe0
Signed-off-by: default avatarZhenhua Huang <zhenhuah@codeaurora.org>
parent 0c4f6840
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1394,7 +1394,8 @@ static inline void __free_iova(struct dma_iommu_mapping *mapping,

	start = (addr - bitmap_base) >>	PAGE_SHIFT;

	if (addr + size > bitmap_base + mapping_size) {
	if ((addr + size - 1 > addr) &&
		(addr + size - 1 > bitmap_base + mapping_size - 1)) {
		/*
		 * The address range to be freed reaches into the iova
		 * range of the next bitmap. This should not happen as