[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1351499113.7394.171.camel@edumazet-glaptop>
Date: Mon, 29 Oct 2012 09:25:13 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Cong Wang <amwang@...hat.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 15:25 +0800, Cong Wang wrote:
> 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.
>
There is no dereference, even if gcc was dumb, since dst is an embedded
struct, not a pointer to a struct.
This wont change in a near future.
> 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?
I dont think this placement will change in a near future, it would break
lot of things.
I guess we can use a BUILD_BUG_ON() instead of a comment that
could be ignored.
Note we could move dst in rtable, if we change the NULL test in
dst_release with some if ((unsigned long)dst < 4000) condition
I'll send a patch against ip_rt_put()
--
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