public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Paul Mundt <lethal@linux-sh.org>,
	Tom Zanussi <zanussi@us.ibm.com>,
	Karim Yaghmour <karim@opersys.com>,
	Jesper Juhl <jesper.juhl@gmail.com>,
	"David J. Wilder" <wilder@us.ibm.com>
Subject: Re: [PATCH] Fix a use after free bug in kernel->userspace relay file support
Date: Thu, 19 Jul 2007 21:42:36 -0400	[thread overview]
Message-ID: <20070720014236.GA5836@Krystal> (raw)
In-Reply-To: <20070719182952.5f437e64.akpm@linux-foundation.org>

* Andrew Morton (akpm@linux-foundation.org) wrote:
> On Thu, 19 Jul 2007 21:09:09 -0400
> Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Coverity spotted what looks like a real possible case of using a 
> > variable after it has been freed.
> > The problem is in kernel/relay.c::relay_open_buf()
> > 
> > If the code hits "goto free_buf;" it ends up in this code :
> > 
> >   free_buf:
> >     	relay_destroy_buf(buf);	<--- calls kfree() on 'buf'.
> >   free_name:
> >    	kfree(tmpname);
> >   end:
> >   	return buf;		<-- use after free of 'buf'.
> > 
> > I read through the callers and they all handle a NULL return 
> > from this function as an error (and hitting the 'free_buf' label 
> > only happens on failure to chan->cb->create_buf_file(), so that 
> > looks like a clear error to me). 
> > 
> > The patch simply sets 'buf' to NULL after the call to 
> > relay_destroy_buf(buf); - as far as I can see that should take 
> > care of the problem.
> > 
> > The patch also corrects a reference to a documentation file while 
> > I was at it.
> > 
> > Note from Mathieu: the documentation reference change should have been
> > done in a separate patch, but I guess no one will really care.
> > 
> > Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> > Acked-by: "David J. Wilder" <wilder@us.ibm.com>
> > Tested-by: "David J. Wilder" <wilder@us.ibm.com>
> > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> 
> I'm going to infer from all this that the patch was actually written
> by Jesper.  Correct?
> 
> If so, it shuld have had From: Jesper Juhl <jesper.juhl@gmail.com>
> right at the start of the changelog.

Yes, it's the case. Thanks.

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2007-07-20  1:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-20  1:09 [PATCH] Fix a use after free bug in kernel->userspace relay file support Mathieu Desnoyers
2007-07-20  1:29 ` Andrew Morton
2007-07-20  1:42   ` Mathieu Desnoyers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-18 21:11 Jesper Juhl
2007-07-19 19:22 ` David J. Wilder
2007-07-20  0:55   ` Jesper Juhl
2007-07-19 19:36 ` Mathieu Desnoyers

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=20070720014236.GA5836@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=jesper.juhl@gmail.com \
    --cc=karim@opersys.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wilder@us.ibm.com \
    --cc=zanussi@us.ibm.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