linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roland McGrath <roland@hack.frob.com>
Subject: Re: [PATCH] coredump: prevent double-free on an error path in core dumper
Date: Wed, 12 Sep 2012 15:00:20 +0200	[thread overview]
Message-ID: <20120912130020.GA29585@redhat.com> (raw)
In-Reply-To: <D958900912E20642BCBC71664EFECE3E6DDEFB8D10@BGMAIL02.nvidia.com>

On 09/12, Venu Byravarasu wrote:
>
> > --- a/fs/binfmt_elf.c
> > +++ b/fs/binfmt_elf.c
> > @@ -1695,30 +1695,19 @@ static int elf_note_info_init(struct elf_note_info
> > *info)
> >  		return 0;
> >  	info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL);
>
> Why don't you change kmalloc to devm_kzalloc, so that free can be ignored altogether.

kzalloc(), I guess...

Still I can't understand what did you mean. If kmalloc() fails we
return "fail" and ->psinfo = NULL, the subsequent kfree(NULL) is nop.

Oleg.


  reply	other threads:[~2012-09-12 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 11:37 [PATCH] coredump: prevent double-free on an error path in core dumper Denys Vlasenko
2012-09-12 11:45 ` Venu Byravarasu
2012-09-12 13:00   ` Oleg Nesterov [this message]
2012-09-12 19:00     ` Oleg Nesterov

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=20120912130020.GA29585@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@hack.frob.com \
    --cc=vbyravarasu@nvidia.com \
    --cc=vda.linux@googlemail.com \
    /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;
as well as URLs for NNTP newsgroup(s).