]> Git Repo - linux.git/blobdiff - mm/mmap.c
mmc: au1xmmc: force non-modular build and remove symbol_get usage
[linux.git] / mm / mmap.c
index 547b405317915a871773b9f1c60411ab70437ecd..3eda23c9ebe7a60427443fec3c8da8f38c163832 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1977,6 +1977,8 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address)
                return -ENOMEM;
        }
 
+       /* Lock the VMA before expanding to prevent concurrent page faults */
+       vma_start_write(vma);
        /*
         * vma->vm_start/vm_end cannot change under us because the caller
         * is required to hold the mmap_lock in read mode.  We need the
@@ -2064,6 +2066,8 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address)
                return -ENOMEM;
        }
 
+       /* Lock the VMA before expanding to prevent concurrent page faults */
+       vma_start_write(vma);
        /*
         * vma->vm_start/vm_end cannot change under us because the caller
         * is required to hold the mmap_lock in read mode.  We need the
@@ -2571,6 +2575,7 @@ end_split_failed:
        __mt_destroy(&mt_detach);
 start_split_failed:
 map_count_exceeded:
+       validate_mm(mm);
        return error;
 }
 
@@ -2804,6 +2809,8 @@ cannot_expand:
        if (vma_iter_prealloc(&vmi))
                goto close_and_free_vma;
 
+       /* Lock the VMA since it is modified after insertion into VMA tree */
+       vma_start_write(vma);
        if (vma->vm_file)
                i_mmap_lock_write(vma->vm_file->f_mapping);
 
@@ -3019,12 +3026,9 @@ int do_vma_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
                bool unlock)
 {
        struct mm_struct *mm = vma->vm_mm;
-       int ret;
 
        arch_unmap(mm, start, end);
-       ret = do_vmi_align_munmap(vmi, vma, mm, start, end, uf, unlock);
-       validate_mm(mm);
-       return ret;
+       return do_vmi_align_munmap(vmi, vma, mm, start, end, uf, unlock);
 }
 
 /*
This page took 0.035067 seconds and 4 git commands to generate.