mm: fix panic caused by __page_handle_poison()
[linux-2.6-microblaze.git] / mm / mmap.c
index aa9de98..52fed23 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -534,6 +534,7 @@ static int find_vma_links(struct mm_struct *mm, unsigned long addr,
 {
        struct rb_node **__rb_link, *__rb_parent, *rb_prev;
 
+       mmap_assert_locked(mm);
        __rb_link = &mm->mm_rb.rb_node;
        rb_prev = __rb_parent = NULL;
 
@@ -1352,9 +1353,8 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
        return hint;
 }
 
-static inline int mlock_future_check(struct mm_struct *mm,
-                                    unsigned long flags,
-                                    unsigned long len)
+int mlock_future_check(struct mm_struct *mm, unsigned long flags,
+                      unsigned long len)
 {
        unsigned long locked, lock_limit;
 
@@ -2304,6 +2304,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
        struct rb_node *rb_node;
        struct vm_area_struct *vma;
 
+       mmap_assert_locked(mm);
        /* Check the cache first. */
        vma = vmacache_find(mm, addr);
        if (likely(vma))
@@ -2993,14 +2994,11 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
        if (mmap_write_lock_killable(mm))
                return -EINTR;
 
-       vma = find_vma(mm, start);
+       vma = vma_lookup(mm, start);
 
        if (!vma || !(vma->vm_flags & VM_SHARED))
                goto out;
 
-       if (start < vma->vm_start)
-               goto out;
-
        if (start + size > vma->vm_end) {
                struct vm_area_struct *next;