From: Dan Carpenter <redacted>
Date: Wed, 11 Jul 2012 09:32:14 +0300
There are a couple places that try to set part of the struct to 0 by
doing:
memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
It assumes that the first element is a dst_entry and the second element
is ->rt6_table. The problem is we changed the struct in 97cac0821a
('ipv6: Store route neighbour in rt6_info struct.') and we aren't
clearing rt->n but instead we're writing past the end of the array.
I've changed it to:
memset(&rt->n, 0, sizeof(*rt) - offsetof(struct rt6_info, n));
The memset in ip6_dst_alloc() was ok but I changed it to use offsetof()
as a cleanup.
Signed-off-by: Dan Carpenter <redacted>
Steffen Klassert had patches to do this more nicely, using "dst + 1"
as the pointer calculation, which therefore works no matter what
elements we add to struct rt6_info after the dst_entry.
I asked him to fix some things, he did too much casting, but he never
respun his patch set. I definitely prefer this gets fixed his way.
http://patchwork.ozlabs.org/patch/169391/
http://patchwork.ozlabs.org/patch/169395/