aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuren Baghdasaryan <[email protected]>2023-02-27 09:36:17 -0800
committerAndrew Morton <[email protected]>2023-04-05 20:02:59 -0700
commit73046fd00b069ffd198eda099dae966e152fae39 (patch)
tree91ca3bca6083ae6ba8762095e11c66072b345886
parentd6ac235de4ba6dc659eebb5f4e5ba0a8523d8424 (diff)
mm: write-lock VMAs before removing them from VMA tree
Write-locking VMAs before isolating them ensures that page fault handlers don't operate on isolated VMAs. [[email protected]: mm/nommu: remove unnecessary VMA locking] Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/all/Y%2F8CJQGNuMUTdLwP@localhost/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Suren Baghdasaryan <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hyeonggon Yoo <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/mmap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 8ba51e73f626..83adf86fd62b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2270,6 +2270,7 @@ int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
static inline int munmap_sidetree(struct vm_area_struct *vma,
struct ma_state *mas_detach)
{
+ vma_start_write(vma);
mas_set_range(mas_detach, vma->vm_start, vma->vm_end - 1);
if (mas_store_gfp(mas_detach, vma, GFP_KERNEL))
return -ENOMEM;