[PATCH -resend v2 3/3] do_coredump: fix the "ispipe" error check

From: Jiri Slaby
Date: Tue Jun 28 2011 - 17:56:57 EST


From: Oleg Nesterov <oleg@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Reviewed-by: Neil Horman <nhorman@xxxxxxxxxxxxx>
---
fs/exec.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 424ec9d..549b7dc 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2112,16 +2112,16 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)

ispipe = format_corename(&cn, signr);

- if (ispipe == -ENOMEM) {
- printk(KERN_WARNING "format_corename failed\n");
- printk(KERN_WARNING "Aborting core\n");
- goto fail_corename;
- }
-
if (ispipe) {
int dump_count;
char **helper_argv;

+ if (ispipe < 0) {
+ printk(KERN_WARNING "format_corename failed\n");
+ printk(KERN_WARNING "Aborting core\n");
+ goto fail_corename;
+ }
+
if (cprm.limit == 1) {
/*
* Normally core limits are irrelevant to pipes, since
--
1.7.6


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/