]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - mm/mlock.c
mm: fix up some user-visible effects of the stack guard page
[net-next-2.6.git] / mm / mlock.c
index 3f82720e05153a59e2fbb566942121763fc9a44d..49e5e4cb82328dea4e45ee9d81e51d5599df54ff 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;