ipv6: avoid two atomics in ipv6_rthdr_rcv()
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 14 Jun 2010 04:39:27 +0000 (04:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Jun 2010 06:13:06 +0000 (23:13 -0700)
Use __in6_dev_get() instead of in6_dev_get()/in6_dev_put()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/exthdrs.c

index 853a633a94d4f4fe55ec1815fadfd27dd7a9fd03..262f105d23b9399e3f6f043e307df3bf69535f6c 100644 (file)
@@ -312,6 +312,7 @@ static int ipv6_destopt_rcv(struct sk_buff *skb)
   Routing header.
  ********************************/
 
+/* called with rcu_read_lock() */
 static int ipv6_rthdr_rcv(struct sk_buff *skb)
 {
        struct inet6_skb_parm *opt = IP6CB(skb);
@@ -324,12 +325,9 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
        struct net *net = dev_net(skb->dev);
        int accept_source_route = net->ipv6.devconf_all->accept_source_route;
 
-       idev = in6_dev_get(skb->dev);
-       if (idev) {
-               if (accept_source_route > idev->cnf.accept_source_route)
-                       accept_source_route = idev->cnf.accept_source_route;
-               in6_dev_put(idev);
-       }
+       idev = __in6_dev_get(skb->dev);
+       if (idev && accept_source_route > idev->cnf.accept_source_route)
+               accept_source_route = idev->cnf.accept_source_route;
 
        if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
            !pskb_may_pull(skb, (skb_transport_offset(skb) +