aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2012-11-16 14:15:00 -0800
committerBen Hutchings <ben@decadent.org.uk>2014-07-11 13:33:33 +0100
commit0efda016ac2fb3db57ee19f5df746eca4250955d (patch)
treeb645155c09c88ae2515fddc8a20cbbbe526bf04a /mm
parent6b3965a54357210adb2c5cf15a42083ef31aab56 (diff)
downloadkernel_samsung_smdk4412-0efda016ac2fb3db57ee19f5df746eca4250955d.zip
kernel_samsung_smdk4412-0efda016ac2fb3db57ee19f5df746eca4250955d.tar.gz
kernel_samsung_smdk4412-0efda016ac2fb3db57ee19f5df746eca4250955d.tar.bz2
mm: highmem: don't treat PKMAP_ADDR(LAST_PKMAP) as a highmem address
commit 498c2280212327858e521e9d21345d4cc2637f54 upstream. kmap_to_page returns the corresponding struct page for a virtual address of an arbitrary mapping. This works by checking whether the address falls in the pkmap region and using the pkmap page tables instead of the linear mapping if appropriate. Unfortunately, the bounds checking means that PKMAP_ADDR(LAST_PKMAP) is incorrectly treated as a highmem address and we can end up walking off the end of pkmap_page_table and subsequently passing junk to pte_page. This patch fixes the bound check to stay within the pkmap tables. Signed-off-by: Will Deacon <will.deacon@arm.com> Cc: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'mm')
-rw-r--r--mm/highmem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/highmem.c b/mm/highmem.c
index 2a07f97..09fc744 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -98,7 +98,7 @@ struct page *kmap_to_page(void *vaddr)
{
unsigned long addr = (unsigned long)vaddr;
- if (addr >= PKMAP_ADDR(0) && addr <= PKMAP_ADDR(LAST_PKMAP)) {
+ if (addr >= PKMAP_ADDR(0) && addr < PKMAP_ADDR(LAST_PKMAP)) {
int i = (addr - PKMAP_ADDR(0)) >> PAGE_SHIFT;
return pte_page(pkmap_page_table[i]);
}