Commit e1ee65d85904c5dd4b9cea1b15d5e85e20eae8a1

Authored by David Howells
Committed by Linus Torvalds
1 parent 7561e8ca0d

NOMMU: Fix __get_user_pages() to pin last page on offset buffers

Fix __get_user_pages() to make it pin the last page on a buffer that doesn't
begin at the start of a page, but is a multiple of PAGE_SIZE in size.

The problem is that __get_user_pages() advances the pointer too much when it
iterates to the next page if the page it's currently looking at isn't used from
the first byte.  This can cause the end of a short VMA to be reached
prematurely, resulting in the last page being lost.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -162,7 +162,7 @@
162 162 }
163 163 if (vmas)
164 164 vmas[i] = vma;
165   - start += PAGE_SIZE;
  165 + start = (start + PAGE_SIZE) & PAGE_MASK;
166 166 }
167 167  
168 168 return i;