Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99b64567 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

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: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Reviewed-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2c563731
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2133,16 +2133,16 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)

	ispipe = format_corename(&cn, signr);

	if (ispipe == -ENOMEM) {
 	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 (ispipe) {
		int dump_count;
		char **helper_argv;

		if (cprm.limit == 1) {
			/*
			 * Normally core limits are irrelevant to pipes, since