]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - mm/mlock.c
8139cp: fix checksum broken
[net-next-2.6.git] / mm / mlock.c
index 49e5e4cb82328dea4e45ee9d81e51d5599df54ff..b70919ce4f72e6941f67b1a5462f5f270c231536 100644 (file)
@@ -135,6 +135,13 @@ void munlock_vma_page(struct page *page)
        }
 }
 
+static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
+{
+       return (vma->vm_flags & VM_GROWSDOWN) &&
+               (vma->vm_start == addr) &&
+               !vma_stack_continue(vma->vm_prev, addr);
+}
+
 /**
  * __mlock_vma_pages_range() -  mlock a range of pages in the vma.
  * @vma:   target vma
@@ -168,11 +175,9 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
                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--;
-               }
+       if (stack_guard_page(vma, start)) {
+               addr += PAGE_SIZE;
+               nr_pages--;
        }
 
        while (nr_pages > 0) {