From: KOSAKI Motohiro Date: Tue, 26 Jul 2011 00:12:09 +0000 (-0700) Subject: pagewalk: fix walk_page_range() don't check find_vma() result properly X-Git-Tag: v3.1-rc1~241^2~103 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b6ddbf7ed4ef2f40e0a27418146eedaa68953c6;p=platform%2Fkernel%2Flinux-stable.git pagewalk: fix walk_page_range() don't check find_vma() result properly The doc of find_vma() says, /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) { (snip) Thus, caller should confirm whether the returned vma matches a desired one. Signed-off-by: KOSAKI Motohiro Cc: Naoya Horiguchi Cc: Hiroyuki Kamezawa Cc: Andrea Arcangeli Cc: Matt Mackall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/pagewalk.c b/mm/pagewalk.c index c3450d5..606bbb4 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -176,7 +176,7 @@ int walk_page_range(unsigned long addr, unsigned long end, * we can't handled it in the same manner as non-huge pages. */ vma = find_vma(walk->mm, addr); - if (vma && is_vm_hugetlb_page(vma)) { + if (vma && vma->vm_start <= addr && is_vm_hugetlb_page(vma)) { if (vma->vm_end < next) next = vma->vm_end; /*