* [PATCH net-next-2.6] tunnels: missing rcu_assign_pointer()
@ 2010-09-09 15:33 Eric Dumazet
2010-09-09 22:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2010-09-09 15:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
xfrm4_tunnel_register() & xfrm6_tunnel_register() should
use rcu_assign_pointer() to make sure previous writes
(to handler->next) are committed to memory before chain
insertion.
deregister functions dont need a particular barrier.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
No risk of crash, because handler->next is NULL before register()
call, but a possibility of packet being dropped.
net/ipv4/tunnel4.c | 2 +-
net/ipv6/tunnel6.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index df59d16..9a17bd2 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -39,7 +39,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
}
handler->next = *pprev;
- *pprev = handler;
+ rcu_assign_pointer(*pprev, handler);
ret = 0;
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c
index 3177fe0..d986472 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -51,7 +51,7 @@ int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family)
}
handler->next = *pprev;
- *pprev = handler;
+ rcu_assign_pointer(*pprev, handler);
ret = 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next-2.6] tunnels: missing rcu_assign_pointer()
2010-09-09 15:33 [PATCH net-next-2.6] tunnels: missing rcu_assign_pointer() Eric Dumazet
@ 2010-09-09 22:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-09-09 22:02 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 09 Sep 2010 17:33:43 +0200
> xfrm4_tunnel_register() & xfrm6_tunnel_register() should
> use rcu_assign_pointer() to make sure previous writes
> (to handler->next) are committed to memory before chain
> insertion.
>
> deregister functions dont need a particular barrier.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-09 22:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-09 15:33 [PATCH net-next-2.6] tunnels: missing rcu_assign_pointer() Eric Dumazet
2010-09-09 22:02 ` 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).