diff options
author | Suren Baghdasaryan <surenb@google.com> | 2023-02-27 09:36:16 -0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-04-05 20:02:58 -0700 |
commit | d6ac235de4ba6dc659eebb5f4e5ba0a8523d8424 (patch) | |
tree | 488ea84e74c50e705741dccd74e6477a31890d2c /mm/mmap.c | |
parent | 10fca64a661199910c7d13077e9678c9a06bf285 (diff) | |
download | lwn-d6ac235de4ba6dc659eebb5f4e5ba0a8523d8424.tar.gz lwn-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/mmap.c')
-rw-r--r-- | mm/mmap.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 82999e0c3c31..8ba51e73f626 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3197,6 +3197,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, get_file(new_vma->vm_file); if (new_vma->vm_ops && new_vma->vm_ops->open) new_vma->vm_ops->open(new_vma); + vma_start_write(new_vma); if (vma_link(mm, new_vma)) goto out_vma_link; *need_rmap_locks = false; |