ipv4: Only compute net once in ipmr_forward_finish
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 16 Sep 2015 01:04:03 +0000 (20:04 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Sep 2015 00:18:34 +0000 (17:18 -0700)
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipmr.c

index 075bc695ae34c7a960894fee72ec46fb3416d725..dfe4e8ec6c3aae1f7f5d688c8a5e720cda3dc054 100644 (file)
@@ -1681,9 +1681,10 @@ static void ip_encap(struct net *net, struct sk_buff *skb,
 static inline int ipmr_forward_finish(struct sock *sk, struct sk_buff *skb)
 {
        struct ip_options *opt = &(IPCB(skb)->opt);
+       struct net *net = dev_net(skb_dst(skb)->dev);
 
-       IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
-       IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len);
+       IP_INC_STATS_BH(net, IPSTATS_MIB_OUTFORWDATAGRAMS);
+       IP_ADD_STATS_BH(net, IPSTATS_MIB_OUTOCTETS, skb->len);
 
        if (unlikely(opt->optlen))
                ip_forward_options(skb);