Skip to content

Commit

Permalink
nommu: get_user_pages(): pin last page on non-page-aligned start
Browse files Browse the repository at this point in the history
The noMMU version of get_user_pages() fails to pin the last page when the
start address isn't page-aligned.  The patch fixes this in a way that
makes find_extend_vma() congruent to its MMU cousin.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Steven J. Magnani authored and Linus Torvalds committed Mar 6, 2010
1 parent f047f4f commit c08c6e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
(VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE);

for (i = 0; i < nr_pages; i++) {
vma = find_vma(mm, start);
vma = find_extend_vma(mm, start);
if (!vma)
goto finish_or_fault;

Expand Down Expand Up @@ -764,7 +764,7 @@ EXPORT_SYMBOL(find_vma);
*/
struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr)
{
return find_vma(mm, addr);
return find_vma(mm, addr & PAGE_MASK);
}

/*
Expand Down

0 comments on commit c08c6e1

Please sign in to comment.