Skip to content

Commit

Permalink
ipv6: avoid two atomics in ipv6_rthdr_rcv()
Browse files Browse the repository at this point in the history
Use __in6_dev_get() instead of in6_dev_get()/in6_dev_put()

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Jun 15, 2010
1 parent 1be3b5f commit f6bc7d9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions net/ipv6/exthdrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) +
Expand Down

0 comments on commit f6bc7d9

Please sign in to comment.