summaryrefslogtreecommitdiffstats
path: root/mm/mremap.c
diff options
context:
space:
mode:
authorSuren Baghdasaryan <surenb@google.com>2023-02-27 18:36:16 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-04-06 05:02:58 +0200
commitd6ac235de4ba6dc659eebb5f4e5ba0a8523d8424 (patch)
tree488ea84e74c50e705741dccd74e6477a31890d2c /mm/mremap.c
parentmm/mmap: write-lock VMAs in vma_prepare before modifying them (diff)
downloadlinux-d6ac235de4ba6dc659eebb5f4e5ba0a8523d8424.tar.xz
linux-d6ac235de4ba6dc659eebb5f4e5ba0a8523d8424.zip
mm/mremap: write-lock VMA while remapping it to a new address range
Write-lock VMA as locked before copying it and when copy_vma produces a new VMA. Link: https://lkml.kernel.org/r/20230227173632.3292573-18-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Laurent Dufour <laurent.dufour@fr.ibm.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r--mm/mremap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 0eaa11c845b9..b11ce6c92099 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -623,6 +623,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
return -ENOMEM;
}
+ vma_start_write(vma);
new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT);
new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff,
&need_rmap_locks);