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 21:00:38 +0200	[thread overview]
Message-ID: <20120912190038.GA12473@redhat.com> (raw)
In-Reply-To: <20120912130020.GA29585@redhat.com>

On 09/12, Oleg Nesterov wrote:
>
> 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.

Denys explained me privately what did you mean.

Well. elf_core_dump() does a lot of kmalloc's. We should either
change them all or nothing. And even if we do this, I think this
particular patch makes sense anyway.

Not sure we want "struct device" for this, perhaps this devres
code should be generalized somehow.

Oleg.


      reply	other threads:[~2012-09-12 18: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
2012-09-12 19:00     ` Oleg Nesterov [this message]

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=20120912190038.GA12473@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).