aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/exec.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 1221c4c43547..6501823b7a1b 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1862,10 +1862,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1862 goto fail; 1862 goto fail;
1863 1863
1864 cred = prepare_creds(); 1864 cred = prepare_creds();
1865 if (!cred) { 1865 if (!cred)
1866 retval = -ENOMEM;
1867 goto fail; 1866 goto fail;
1868 }
1869 1867
1870 down_write(&mm->mmap_sem); 1868 down_write(&mm->mmap_sem);
1871 /* 1869 /*
@@ -1873,8 +1871,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1873 */ 1871 */
1874 if (mm->core_state || !__get_dumpable(cprm.mm_flags)) { 1872 if (mm->core_state || !__get_dumpable(cprm.mm_flags)) {
1875 up_write(&mm->mmap_sem); 1873 up_write(&mm->mmap_sem);
1876 put_cred(cred); 1874 goto fail_creds;
1877 goto fail;
1878 } 1875 }
1879 1876
1880 /* 1877 /*
@@ -1889,10 +1886,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1889 } 1886 }
1890 1887
1891 retval = coredump_wait(exit_code, &core_state); 1888 retval = coredump_wait(exit_code, &core_state);
1892 if (retval < 0) { 1889 if (retval < 0)
1893 put_cred(cred); 1890 goto fail_creds;
1894 goto fail;
1895 }
1896 1891
1897 old_cred = override_creds(cred); 1892 old_cred = override_creds(cred);
1898 1893
@@ -2009,9 +2004,10 @@ fail_dropcount:
2009 if (ispipe) 2004 if (ispipe)
2010 atomic_dec(&core_dump_count); 2005 atomic_dec(&core_dump_count);
2011fail_unlock: 2006fail_unlock:
2007 coredump_finish(mm);
2012 revert_creds(old_cred); 2008 revert_creds(old_cred);
2009fail_creds:
2013 put_cred(cred); 2010 put_cred(cred);
2014 coredump_finish(mm);
2015fail: 2011fail:
2016 return; 2012 return;
2017} 2013}