]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap: Fix mmap_region code chunk location of Can addr..
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 29 Jan 2021 14:51:46 +0000 (09:51 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 29 Jan 2021 14:51:46 +0000 (09:51 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/mmap.c

index 47319d6c5bcc76eb606783b55d854e060d04ccba..e569d1cb0a3fc08bd739cffc7b5e685a438b6714 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2557,6 +2557,17 @@ cannot_expand:
                if (error)
                        goto unmap_and_free_vma;
 
+               /* Can addr have changed??
+                *
+                * Answer: Yes, several device drivers can do it in their
+                *         f_op->mmap method. -DaveM
+                * Bug: If addr is changed, prev and the maple tree data should
+                * be updated for vma_link()
+                */
+               WARN_ON_ONCE(addr != vma->vm_start);
+
+               addr = vma->vm_start;
+
                /* If vm_flags changed after call_mmap(), we should try merge vma again
                 * as we may succeed this time.
                 */
@@ -2584,16 +2595,6 @@ cannot_expand:
                        }
                }
 
-               /* Can addr have changed??
-                *
-                * Answer: Yes, several device drivers can do it in their
-                *         f_op->mmap method. -DaveM
-                * Bug: If addr is changed, prev and the maple tree data should
-                * be updated for vma_link()
-                */
-               WARN_ON_ONCE(addr != vma->vm_start);
-
-               addr = vma->vm_start;
                vm_flags = vma->vm_flags;
        } else if (vm_flags & VM_SHARED) {
                error = shmem_zero_setup(vma);