* [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation
@ 2012-07-05 13:18 Steffen Klassert
2012-07-05 15:16 ` Eric Dumazet
2012-07-05 21:21 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-07-05 13:18 UTC (permalink / raw)
To: David Miller; +Cc: netdev
git commit 97cac082 (ipv6: Store route neighbour in rt6_info struct)
added a neighbour pointer to rt6_info. Currently we don't initialize
this pointer at allocation time. We assume this pointer to be valid
if it is not a null pointer, so initialize it on allocation.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/route.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ceff71d..6cc6c88 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -273,7 +273,7 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
0, 0, flags);
if (rt) {
- memset(&rt->rt6i_table, 0,
+ memset(&rt->n, 0,
sizeof(*rt) - sizeof(struct dst_entry));
rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation
2012-07-05 13:18 [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation Steffen Klassert
@ 2012-07-05 15:16 ` Eric Dumazet
2012-07-06 6:54 ` Steffen Klassert
2012-07-05 21:21 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2012-07-05 15:16 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David Miller, netdev
On Thu, 2012-07-05 at 15:18 +0200, Steffen Klassert wrote:
> git commit 97cac082 (ipv6: Store route neighbour in rt6_info struct)
> added a neighbour pointer to rt6_info. Currently we don't initialize
> this pointer at allocation time. We assume this pointer to be valid
> if it is not a null pointer, so initialize it on allocation.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
> net/ipv6/route.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index ceff71d..6cc6c88 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -273,7 +273,7 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
> 0, 0, flags);
>
> if (rt) {
> - memset(&rt->rt6i_table, 0,
> + memset(&rt->n, 0,
> sizeof(*rt) - sizeof(struct dst_entry));
> rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
> }
Hmm, could we find a way to avoid this for future changes ?
We know dst_entry is the first field, so maybe :
if (rt) {
struct dst_entry *dst = (struct dst_entry *)rt;
memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation
2012-07-05 13:18 [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation Steffen Klassert
2012-07-05 15:16 ` Eric Dumazet
@ 2012-07-05 21:21 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2012-07-05 21:21 UTC (permalink / raw)
To: steffen.klassert; +Cc: netdev
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 5 Jul 2012 15:18:28 +0200
> git commit 97cac082 (ipv6: Store route neighbour in rt6_info struct)
> added a neighbour pointer to rt6_info. Currently we don't initialize
> this pointer at allocation time. We assume this pointer to be valid
> if it is not a null pointer, so initialize it on allocation.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Applied, but as Eric said we need to find a way to avoid having to
make changes like this every time we simply want to add a struct
member to rt6_info.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation
2012-07-05 15:16 ` Eric Dumazet
@ 2012-07-06 6:54 ` Steffen Klassert
2012-07-06 9:16 ` Steffen Klassert
0 siblings, 1 reply; 5+ messages in thread
From: Steffen Klassert @ 2012-07-06 6:54 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On Thu, Jul 05, 2012 at 05:16:44PM +0200, Eric Dumazet wrote:
> On Thu, 2012-07-05 at 15:18 +0200, Steffen Klassert wrote:
> >
> > if (rt) {
> > - memset(&rt->rt6i_table, 0,
> > + memset(&rt->n, 0,
> > sizeof(*rt) - sizeof(struct dst_entry));
> > rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
> > }
>
> Hmm, could we find a way to avoid this for future changes ?
>
> We know dst_entry is the first field, so maybe :
>
> if (rt) {
> struct dst_entry *dst = (struct dst_entry *)rt;
>
> memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
>
Yes, I think we need to do something like this.
I've just noticed that ip6_blackhole_route, xfrm_alloc_dst,
dn_route_output_slow and dn_route_input_slow have the same issue.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation
2012-07-06 6:54 ` Steffen Klassert
@ 2012-07-06 9:16 ` Steffen Klassert
0 siblings, 0 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-07-06 9:16 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On Fri, Jul 06, 2012 at 08:54:26AM +0200, Steffen Klassert wrote:
> On Thu, Jul 05, 2012 at 05:16:44PM +0200, Eric Dumazet wrote:
> >
> > Hmm, could we find a way to avoid this for future changes ?
> >
> > We know dst_entry is the first field, so maybe :
> >
> > if (rt) {
> > struct dst_entry *dst = (struct dst_entry *)rt;
> >
> > memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
> >
>
> Yes, I think we need to do something like this.
>
> I've just noticed that ip6_blackhole_route, xfrm_alloc_dst,
> dn_route_output_slow and dn_route_input_slow have the same issue.
Actually, decnet is ok. So I'll send patches with the change you
suggested for ipv6 and xfrm.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-06 9:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-05 13:18 [PATCH net-next] ipv6: Initialize the neighbour pointer of rt6_info on allocation Steffen Klassert
2012-07-05 15:16 ` Eric Dumazet
2012-07-06 6:54 ` Steffen Klassert
2012-07-06 9:16 ` Steffen Klassert
2012-07-05 21:21 ` David Miller
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).