tunnels: missing rcu_assign_pointer()
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 9 Sep 2010 05:33:43 +0000 (05:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Sep 2010 22:02:39 +0000 (15:02 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tunnel4.c
net/ipv6/tunnel6.c

index df59d16..9a17bd2 100644 (file)
@@ -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;
 
index 3177fe0..d986472 100644 (file)
@@ -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;