[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1351495523.8221.8.camel@cr0>
Date: Mon, 29 Oct 2012 15:25:23 +0800
From: Cong Wang <amwang@...hat.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net-next] ipv6: fix a potential NULL deref
On Mon, 2012-10-29 at 08:05 +0100, Eric Dumazet wrote:
> On Mon, 2012-10-29 at 14:49 +0800, Cong Wang wrote:
> > On Mon, 2012-10-29 at 07:10 +0100, Eric Dumazet wrote:
> > > > - dst_release(&rt->dst);
> > > > + if (rt)
> > > > + dst_release(&rt->dst);
> > > > }
> > > >
> > >
> > > dst_release() is like kfree(), it accepts a NULL argument.
> > >
> >
> > 'rt->dst' already dereferences 'rt', no matter dst_release() accepts
> > NULL or not.
> >
> >
>
> &rt->dst doesnt dereference rt, you are quite mistaken.
>
> if rt is NULL, &rt->dst is also NULL
>
Oh, yeah, gcc should be smart enough to do calculation without deref it
given it has the offset and the address. And dst happens to be first
field of rt, so offset is 0, &rt->dst should be NULL too if rt is NULL.
But this will be a problem if someone moved dst inside rt, as there is
no comment saying dst has to be the first one?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists