aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 2c942e2d14ea..4ccaaa4b13b2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1692,7 +1692,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1692 if (!binfmt || !binfmt->core_dump) 1692 if (!binfmt || !binfmt->core_dump)
1693 goto fail; 1693 goto fail;
1694 down_write(&mm->mmap_sem); 1694 down_write(&mm->mmap_sem);
1695 if (!get_dumpable(mm)) { 1695 /*
1696 * If another thread got here first, or we are not dumpable, bail out.
1697 */
1698 if (mm->core_waiters || !get_dumpable(mm)) {
1696 up_write(&mm->mmap_sem); 1699 up_write(&mm->mmap_sem);
1697 goto fail; 1700 goto fail;
1698 } 1701 }
@@ -1706,7 +1709,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1706 flag = O_EXCL; /* Stop rewrite attacks */ 1709 flag = O_EXCL; /* Stop rewrite attacks */
1707 current->fsuid = 0; /* Dump root private */ 1710 current->fsuid = 0; /* Dump root private */
1708 } 1711 }
1709 set_dumpable(mm, 0);
1710 1712
1711 retval = coredump_wait(exit_code); 1713 retval = coredump_wait(exit_code);
1712 if (retval < 0) 1714 if (retval < 0)