aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2012-01-26 05:47:11 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-01-27 16:26:38 -0500
commit3c424f359898aff48c3d5bed608ac706f8a528c3 (patch)
treeaeddc0dd01e9e9f5a690f90ddb1bfb7a588ea929
parent9a95b9e7416c2e7fa799e54078a1adf84a7ed0bf (diff)
ARM: 7304/1: ioremap: fix boundary check when reusing static mapping
Since commit 576d2f2525612ecb5af029a76f21f22a3b82563d "ARM: add generic ioremap optimization by reusing static mappings" ioremap() is trying to reuse existing static mapping when possible. The condition checking boundaries of the requested and existing mappings didn't take in-page offset into consideration though, which lead to obscure and hard to debug problems when requested mapping crossed end of the static one. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mm/ioremap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 80632e8d7538..ba159370fa5f 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -225,7 +225,8 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
225 if ((area->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype)) 225 if ((area->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype))
226 continue; 226 continue;
227 if (__phys_to_pfn(area->phys_addr) > pfn || 227 if (__phys_to_pfn(area->phys_addr) > pfn ||
228 __pfn_to_phys(pfn) + size-1 > area->phys_addr + area->size-1) 228 __pfn_to_phys(pfn) + offset + size-1 >
229 area->phys_addr + area->size-1)
229 continue; 230 continue;
230 /* we can drop the lock here as we know *area is static */ 231 /* we can drop the lock here as we know *area is static */
231 read_unlock(&vmlist_lock); 232 read_unlock(&vmlist_lock);