]> Git Repo - linux.git/commitdiff
vma_merge: set vma iterator to correct position.
authorLiam R. Howlett <[email protected]>
Fri, 20 Jan 2023 16:26:50 +0000 (11:26 -0500)
committerAndrew Morton <[email protected]>
Fri, 10 Feb 2023 00:51:38 +0000 (16:51 -0800)
When merging the previous value, set the vma iterator to the previous
slot.  Don't use the vma iterator to get the next/prev so that it is in
the correct position for a write.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Liam R. Howlett <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
mm/mmap.c

index 8ce4cee42dce19b2e12b390d41101edb9b92e6e7..b698a96d0511685109c055c043ae7546ff5e09e7 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -932,6 +932,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
                    && can_vma_merge_after(prev, vm_flags, anon_vma, file,
                                   pgoff, vm_userfaultfd_ctx, anon_name)) {
                        merge_prev = true;
+                       vma_prev(vmi);
                }
        }
        /* Can we merge the successor? */
@@ -1023,9 +1024,6 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
        validate_mm(mm);
        khugepaged_enter_vma(res, vm_flags);
 
-       if (res)
-               vma_iter_set(vmi, end);
-
        return res;
 }
 
This page took 0.053418 seconds and 4 git commands to generate.