]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/ip_input.c
ip: Router Alert RCU conversion
[net-next-2.6.git] / net / ipv4 / ip_input.c
index d52c9da644cfaa0c6bd2b474794d49f051da9c7b..d274078b16650009248d3971077c1b3f8bf28f2b 100644 (file)
 #include <linux/netlink.h>
 
 /*
- *     Process Router Attention IP option
+ *     Process Router Attention IP option (RFC 2113)
  */
 int ip_call_ra_chain(struct sk_buff *skb)
 {
@@ -155,8 +155,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
        struct sock *last = NULL;
        struct net_device *dev = skb->dev;
 
-       read_lock(&ip_ra_lock);
-       for (ra = ip_ra_chain; ra; ra = ra->next) {
+       for (ra = rcu_dereference(ip_ra_chain); ra; ra = rcu_dereference(ra->next)) {
                struct sock *sk = ra->sk;
 
                /* If socket is bound to an interface, only report
@@ -167,10 +166,8 @@ int ip_call_ra_chain(struct sk_buff *skb)
                     sk->sk_bound_dev_if == dev->ifindex) &&
                    net_eq(sock_net(sk), dev_net(dev))) {
                        if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-                               if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
-                                       read_unlock(&ip_ra_lock);
+                               if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN))
                                        return 1;
-                               }
                        }
                        if (last) {
                                struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
@@ -183,10 +180,8 @@ int ip_call_ra_chain(struct sk_buff *skb)
 
        if (last) {
                raw_rcv(last, skb);
-               read_unlock(&ip_ra_lock);
                return 1;
        }
-       read_unlock(&ip_ra_lock);
        return 0;
 }