aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 1d55d7536641..1221c4c43547 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1841,10 +1841,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1841 struct cred *cred; 1841 struct cred *cred;
1842 int retval = 0; 1842 int retval = 0;
1843 int flag = 0; 1843 int flag = 0;
1844 int ispipe = 0; 1844 int ispipe;
1845 char **helper_argv = NULL;
1846 int helper_argc = 0;
1847 int dump_count = 0;
1848 static atomic_t core_dump_count = ATOMIC_INIT(0); 1845 static atomic_t core_dump_count = ATOMIC_INIT(0);
1849 struct coredump_params cprm = { 1846 struct coredump_params cprm = {
1850 .signr = signr, 1847 .signr = signr,
@@ -1914,6 +1911,9 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1914 unlock_kernel(); 1911 unlock_kernel();
1915 1912
1916 if (ispipe) { 1913 if (ispipe) {
1914 int dump_count;
1915 char **helper_argv;
1916
1917 if (cprm.limit == 1) { 1917 if (cprm.limit == 1) {
1918 /* 1918 /*
1919 * Normally core limits are irrelevant to pipes, since 1919 * Normally core limits are irrelevant to pipes, since
@@ -1935,6 +1935,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1935 printk(KERN_WARNING "Aborting core\n"); 1935 printk(KERN_WARNING "Aborting core\n");
1936 goto fail_unlock; 1936 goto fail_unlock;
1937 } 1937 }
1938 cprm.limit = RLIM_INFINITY;
1938 1939
1939 dump_count = atomic_inc_return(&core_dump_count); 1940 dump_count = atomic_inc_return(&core_dump_count);
1940 if (core_pipe_limit && (core_pipe_limit < dump_count)) { 1941 if (core_pipe_limit && (core_pipe_limit < dump_count)) {
@@ -1944,26 +1945,21 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1944 goto fail_dropcount; 1945 goto fail_dropcount;
1945 } 1946 }
1946 1947
1947 helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc); 1948 helper_argv = argv_split(GFP_KERNEL, corename+1, NULL);
1948 if (!helper_argv) { 1949 if (!helper_argv) {
1949 printk(KERN_WARNING "%s failed to allocate memory\n", 1950 printk(KERN_WARNING "%s failed to allocate memory\n",
1950 __func__); 1951 __func__);
1951 goto fail_dropcount; 1952 goto fail_dropcount;
1952 } 1953 }
1953 1954
1954 cprm.limit = RLIM_INFINITY; 1955 retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
1955 1956 NULL, UMH_WAIT_EXEC, umh_pipe_setup,
1956 /* SIGPIPE can happen, but it's just never processed */ 1957 NULL, &cprm);
1957 cprm.file = NULL; 1958 argv_free(helper_argv);
1958 if (call_usermodehelper_fns(helper_argv[0], helper_argv, NULL, 1959 if (retval) {
1959 UMH_WAIT_EXEC, umh_pipe_setup,
1960 NULL, &cprm)) {
1961 if (cprm.file)
1962 filp_close(cprm.file, NULL);
1963
1964 printk(KERN_INFO "Core dump to %s pipe failed\n", 1960 printk(KERN_INFO "Core dump to %s pipe failed\n",
1965 corename); 1961 corename);
1966 goto fail_dropcount; 1962 goto close_fail;
1967 } 1963 }
1968 } else { 1964 } else {
1969 struct inode *inode; 1965 struct inode *inode;
@@ -2003,17 +1999,16 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
2003 retval = binfmt->core_dump(&cprm); 1999 retval = binfmt->core_dump(&cprm);
2004 if (retval) 2000 if (retval)
2005 current->signal->group_exit_code |= 0x80; 2001 current->signal->group_exit_code |= 0x80;
2006close_fail: 2002
2007 if (ispipe && core_pipe_limit) 2003 if (ispipe && core_pipe_limit)
2008 wait_for_dump_helpers(cprm.file); 2004 wait_for_dump_helpers(cprm.file);
2009 filp_close(cprm.file, NULL); 2005close_fail:
2006 if (cprm.file)
2007 filp_close(cprm.file, NULL);
2010fail_dropcount: 2008fail_dropcount:
2011 if (dump_count) 2009 if (ispipe)
2012 atomic_dec(&core_dump_count); 2010 atomic_dec(&core_dump_count);
2013fail_unlock: 2011fail_unlock:
2014 if (helper_argv)
2015 argv_free(helper_argv);
2016
2017 revert_creds(old_cred); 2012 revert_creds(old_cred);
2018 put_cred(cred); 2013 put_cred(cred);
2019 coredump_finish(mm); 2014 coredump_finish(mm);