[ovs-dev] [RFC PATCH kernel 08/10] ip6_tunnel: do not update stats if no netdev given

Jiri Benc jbenc at redhat.com
Thu May 14 18:10:50 UTC 2015


Other users of IPv6 tunneling (e.g. openvswitch) may not have a net_device
that represents the tunnel.

Signed-off-by: Jiri Benc <jbenc at redhat.com>
---
 include/net/ip6_tunnel.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index b8529aa1dae7..c74916a09d53 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -76,12 +76,15 @@ int ip6_tnl_get_iflink(const struct net_device *dev);
 static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
 				  struct net_device *dev)
 {
-	struct net_device_stats *stats = &dev->stats;
+	struct net_device_stats *stats;
 	int pkt_len, err;
 
 	pkt_len = skb->len;
 	err = ip6_local_out_sk(sk, skb);
 
+	if (!dev)
+		return;
+	stats = &dev->stats;
 	if (net_xmit_eval(err) == 0) {
 		struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
 		u64_stats_update_begin(&tstats->syncp);
-- 
1.8.3.1




More information about the dev mailing list