sctp: fix association hangs due to errors when reneging events from the ordering...
[firefly-linux-kernel-4.4.55.git] / mm / mlock.c
index d6378feb2950678f1799e7ffecac9630a2bb3996..e6638f565d42669a17989e45450b23c2ac10662a 100644 (file)
@@ -160,7 +160,7 @@ long __mlock_vma_pages_range(struct vm_area_struct *vma,
 {
        struct mm_struct *mm = vma->vm_mm;
        unsigned long addr = start;
-       int nr_pages = (end - start) / PAGE_SIZE;
+       unsigned long nr_pages = (end - start) / PAGE_SIZE;
        int gup_flags;
 
        VM_BUG_ON(start & ~PAGE_MASK);
@@ -185,6 +185,10 @@ long __mlock_vma_pages_range(struct vm_area_struct *vma,
        if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))
                gup_flags |= FOLL_FORCE;
 
+       /*
+        * We made sure addr is within a VMA, so the following will
+        * not result in a stack expansion that recurses back here.
+        */
        return __get_user_pages(current, mm, addr, nr_pages, gup_flags,
                                NULL, NULL, nonblocking);
 }
@@ -378,7 +382,7 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
        unsigned long end, nstart, nend;
        struct vm_area_struct *vma = NULL;
        int locked = 0;
-       int ret = 0;
+       long ret = 0;
 
        VM_BUG_ON(start & ~PAGE_MASK);
        VM_BUG_ON(len != PAGE_ALIGN(len));