prctl: avoid using mmap_sem for exe_file serialization
[linux-2.6-block.git] / fs / exec.c
index c7f9b733406dc22165647a8f415ce00324ae7daf..a5fef835ebc59fe1dab0311dab0f4fe427894b50 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1078,7 +1078,13 @@ int flush_old_exec(struct linux_binprm * bprm)
        if (retval)
                goto out;
 
+       /*
+        * Must be called _before_ exec_mmap() as bprm->mm is
+        * not visibile until then. This also enables the update
+        * to be lockless.
+        */
        set_mm_exe_file(bprm->mm, bprm->file);
+
        /*
         * Release all of the old mmap stuff
         */