From: Dan Carpenter <error27@gmail.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: richard -rw- weinberger <richard.weinberger@gmail.com>,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Sage Weil <sage@newdream.net>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] Ceph: Fix a use-after-free bug in ceph_destroy_client().
Date: Sun, 26 Dec 2010 01:46:58 +0300 [thread overview]
Message-ID: <20101225224658.GC19019@bicker> (raw)
In-Reply-To: <alpine.LNX.2.00.1012252223380.10759@swampdragon.chaosbits.net>
On Sat, Dec 25, 2010 at 10:24:57PM +0100, Jesper Juhl wrote:
> On Sat, 25 Dec 2010, richard -rw- weinberger wrote:
>
> > On Sat, Dec 25, 2010 at 7:17 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> > > Hello,
> > >
> > > In net/ceph/ceph_common.c::ceph_destroy_client() the pointer 'client' is
> > > freed by kfree() and subsequently used in a call to dout() - use after
> > > free bug.
> >
> > Not really. %p reads only the address of "client".
> > kfree() does not alter this address.
> >
>
> Ok, I see your point and you are correct. But still, the patch does not
> change behaviour and it makes it absolutely clear that there's no
> use-after-free bug, so it might still have merit... or?
>
I see these with Smatch as well. This type of usage is quite common.
People do it deliberately and I guess they feel it's readable. Don't
change them.
If it were something that a static checker couldn't figure out, then
I'd say change it, but really the static checkers should just be made
smarter. Some day I'm going to make Smatch complain if it's a %s in
the string instead of a %p, but for now I just ignore the false
positives.
regards,
dan carpenter
prev parent reply other threads:[~2010-12-25 22:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-25 18:17 [PATCH] Ceph: Fix a use-after-free bug in ceph_destroy_client() Jesper Juhl
2010-12-25 21:12 ` richard -rw- weinberger
2010-12-25 21:24 ` Jesper Juhl
2010-12-25 21:40 ` richard -rw- weinberger
2010-12-25 21:35 ` Jesper Juhl
2010-12-25 22:46 ` Dan Carpenter [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=20101225224658.GC19019@bicker \
--to=error27@gmail.com \
--cc=ceph-devel@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richard.weinberger@gmail.com \
--cc=sage@newdream.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).