diff options
author | Oleg Nesterov <oleg@redhat.com> | 2011-07-26 19:08:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:43 -0400 |
commit | 99b64567486716d18b2156cad188d86478816e4f (patch) | |
tree | 40ab51505909d417c01877c3dff97b7cabcf473d | |
parent | 2c563731fee0f625924f72e854957bc77601e8b3 (diff) |
do_coredump: fix the "ispipe" error check
do_coredump() assumes that if format_corename() fails it should return
-ENOMEM. This is not true, for example cn_print_exe_file() can propagate
the error from d_path. Even if it was true, this is too fragile. Change
the code to check "ispipe < 0".
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/exec.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -2133,16 +2133,16 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs) | |||
2133 | 2133 | ||
2134 | ispipe = format_corename(&cn, signr); | 2134 | ispipe = format_corename(&cn, signr); |
2135 | 2135 | ||
2136 | if (ispipe == -ENOMEM) { | ||
2137 | printk(KERN_WARNING "format_corename failed\n"); | ||
2138 | printk(KERN_WARNING "Aborting core\n"); | ||
2139 | goto fail_corename; | ||
2140 | } | ||
2141 | |||
2142 | if (ispipe) { | 2136 | if (ispipe) { |
2143 | int dump_count; | 2137 | int dump_count; |
2144 | char **helper_argv; | 2138 | char **helper_argv; |
2145 | 2139 | ||
2140 | if (ispipe < 0) { | ||
2141 | printk(KERN_WARNING "format_corename failed\n"); | ||
2142 | printk(KERN_WARNING "Aborting core\n"); | ||
2143 | goto fail_corename; | ||
2144 | } | ||
2145 | |||
2146 | if (cprm.limit == 1) { | 2146 | if (cprm.limit == 1) { |
2147 | /* | 2147 | /* |
2148 | * Normally core limits are irrelevant to pipes, since | 2148 | * Normally core limits are irrelevant to pipes, since |