mm: fix up some user-visible effects of the stack guard page
[pandora-kernel.git] / mm / mlock.c
index 3f82720..49e5e4c 100644 (file)
@@ -167,6 +167,14 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
        if (vma->vm_flags & VM_WRITE)
                gup_flags |= FOLL_WRITE;
 
+       /* We don't try to access the guard page of a stack vma */
+       if (vma->vm_flags & VM_GROWSDOWN) {
+               if (start == vma->vm_start) {
+                       start += PAGE_SIZE;
+                       nr_pages--;
+               }
+       }
+
        while (nr_pages > 0) {
                int i;