Btrfs: finish read pages in the order they are submitted
[linux-2.6.git] / fs / exec.c
index 6dc92c3..ba112bd 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -624,10 +624,8 @@ int setup_arg_pages(struct linux_binprm *bprm,
        /* Move stack pages down in memory. */
        if (stack_shift) {
                ret = shift_arg_pages(vma, stack_shift);
-               if (ret) {
-                       up_write(&mm->mmap_sem);
-                       return ret;
-               }
+               if (ret)
+                       goto out_unlock;
        }
 
 #ifdef CONFIG_STACK_GROWSUP
@@ -641,7 +639,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
 
 out_unlock:
        up_write(&mm->mmap_sem);
-       return 0;
+       return ret;
 }
 EXPORT_SYMBOL(setup_arg_pages);
 
@@ -1397,10 +1395,12 @@ out_ret:
 
 void set_binfmt(struct linux_binfmt *new)
 {
-       if (current->binfmt)
-               module_put(current->binfmt->module);
+       struct mm_struct *mm = current->mm;
+
+       if (mm->binfmt)
+               module_put(mm->binfmt->module);
 
-       current->binfmt = new;
+       mm->binfmt = new;
        if (new)
                __module_get(new->module);
 }
@@ -1770,7 +1770,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 
        audit_core_dumps(signr);
 
-       binfmt = current->binfmt;
+       binfmt = mm->binfmt;
        if (!binfmt || !binfmt->core_dump)
                goto fail;