Merge tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg...
[platform/kernel/linux-starfive.git] / fs / exec.c
index 1a827d5..6518e33 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -701,6 +701,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
        if (vma != vma_next(&vmi))
                return -EFAULT;
 
+       vma_iter_prev_range(&vmi);
        /*
         * cover the whole range: [new_start, old_end)
         */
@@ -1276,8 +1277,8 @@ int begin_new_exec(struct linux_binprm * bprm)
 
        /*
         * Must be called _before_ exec_mmap() as bprm->mm is
-        * not visible until then. This also enables the update
-        * to be lockless.
+        * not visible until then. Doing it here also ensures
+        * we don't race against replace_mm_exe_file().
         */
        retval = set_mm_exe_file(bprm->mm, bprm->file);
        if (retval)