]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Remove VMA Iterator reset from vma_expand()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 24 Apr 2023 20:36:31 +0000 (16:36 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 24 Apr 2023 20:42:18 +0000 (16:42 -0400)
Update callers to vma_expand() to set the vma iterator to the correct
position.  Detect the incorrect location with a MAS_WARN_ON() to debug
what is going on.

Update the caller in shift_arg_pages() to set the vma iterator
correctly.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
fs/exec.c
mm/mmap.c

index 87cf3a2f0e9a1bdb2bd1eb0ae9caf67cddcbd291..8a9a529ba18058f1246f12a6171f642a7a352d2c 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -696,6 +696,8 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
        if (vma != vma_next(&vmi))
                return -EFAULT;
 
+       vma_iter_prev_range(&vmi);
+
        /*
         * cover the whole range: [new_start, old_end)
         */
index 4c7c0e2c8fab7b65c75d691fb8a86297a4732059..3e265c7deaeb003d86ee59c35c1557758e3b8f7a 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -680,8 +680,7 @@ int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma,
 
        vma_prepare(&vp);
        vma_adjust_trans_huge(vma, start, end, 0);
-       /* VMA iterator points to previous, so set to start if necessary */
-       if (vma_iter_addr(vmi) != start)
+       if (MAS_WARN_ON(&vmi->mas, vma_iter_addr(vmi) != start))
                vma_iter_set(vmi, start);
 
        vma->vm_start = start;