Skip to content

Commit

Permalink
pagewalk: fix walk_page_range() don't check find_vma() result properly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Hiroyuki Kamezawa <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Matt Mackall <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kosaki authored and torvalds committed Jul 26, 2011
1 parent 45ebb84 commit 4b6ddbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/pagewalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*
Expand Down

0 comments on commit 4b6ddbf

Please sign in to comment.