public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Oleg Nesterov <oleg@redhat.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andi Kleen <andi@firstfloor.org>,
	Xiaotian Feng <dfeng@redhat.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Jiri Slaby <jirislaby@gmail.com>
Subject: Re: [PATCH] do_coredump: fix the "ispipe" error check
Date: Tue, 07 Jun 2011 21:00:27 +0200	[thread overview]
Message-ID: <4DEE754B.1020706@suse.cz> (raw)
In-Reply-To: <20110607183542.GA5559@redhat.com>

On 06/07/2011 08:35 PM, Oleg Nesterov wrote:
> 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>

Acked-by: Jiri Slaby <jslaby@suse.cz>

> ---
> 
>  fs/exec.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> --- ptrace/fs/exec.c~corename_errcode	2011-06-07 19:44:30.000000000 +0200
> +++ ptrace/fs/exec.c	2011-06-07 20:20:48.000000000 +0200
> @@ -2092,16 +2092,16 @@ void do_coredump(long signr, int exit_co
>  
>  	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
> 

thanks,
-- 
js
suse labs

  reply	other threads:[~2011-06-07 19:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 14:30 [PATCH v2 1/2] coredump: use task comm instead of (unknown) Jiri Slaby
2011-06-07 14:30 ` [PATCH v2 2/2] coredump: escape / in hostname and comm Jiri Slaby
2011-08-30 15:21   ` Earl Chew
2011-06-07 18:16 ` [PATCH v2 1/2] coredump: use task comm instead of (unknown) Oleg Nesterov
2011-06-07 18:30   ` Jiri Slaby
2011-06-08 19:26     ` Oleg Nesterov
2011-06-07 18:35   ` [PATCH] do_coredump: fix the "ispipe" error check Oleg Nesterov
2011-06-07 19:00     ` Jiri Slaby [this message]
2011-06-07 19:07     ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DEE754B.1020706@suse.cz \
    --to=jslaby@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=dfeng@redhat.com \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=oleg@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox