From: "Eric Van Hensbergen" <ericvh@gmail.com>
To: "Adrian Bunk" <bunk@stusta.de>
Cc: "Latchesar Ionkov" <lucho@ionkov.net>,
v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: net/9p/mux.c: use-after-free
Date: Wed, 25 Jul 2007 13:43:16 -0500 [thread overview]
Message-ID: <a4e6962a0707251143ie0b0ce8s7d4a9078fed7eb26@mail.gmail.com> (raw)
In-Reply-To: <20070723012014.GV26212@stusta.de>
On 7/22/07, Adrian Bunk <bunk@stusta.de> wrote:
> The Coverity checker spotted the following use-after-free
> in net/9p/mux.c:
>
> <-- snip -->
>
> ...
> struct p9_conn *p9_conn_create(struct p9_transport *trans, int msize,
> unsigned char *extended)
> {
> ...
> if (!m->tagpool) {
> kfree(m);
> return ERR_PTR(PTR_ERR(m->tagpool));
> }
> ...
>
> <-- snip -->
>
I've got a fix for this one:
if (!m->tagpool) {
mtmp = ERR_PTR(PTR_ERR(m->tagpool));
kfree(m);
return mtmp;
}
but I was wondering about one of the other returns further down the function:
...
memset(&m->poll_waddr, 0, sizeof(m->poll_waddr));
m->poll_task = NULL;
n = p9_mux_poll_start(m);
if (n)
return ERR_PTR(n);
n = trans->poll(trans, &m->pt);
...
lucho: doesn't that constitute a leak? Shouldn't we be doing:
if (n) {
kfree(m);
return ERR_PTR(n);
}
-eric
next prev parent reply other threads:[~2007-07-25 18:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 1:20 net/9p/mux.c: use-after-free Adrian Bunk
2007-07-25 18:43 ` Eric Van Hensbergen [this message]
2007-07-25 19:13 ` Latchesar Ionkov
2007-07-25 19:45 ` Eric Van Hensbergen
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=a4e6962a0707251143ie0b0ce8s7d4a9078fed7eb26@mail.gmail.com \
--to=ericvh@gmail.com \
--cc=bunk@stusta.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=netdev@vger.kernel.org \
--cc=v9fs-developer@lists.sourceforge.net \
/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).