Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / ip_tunnel.c
index 83ede2e7ca42266ccdc3538f388819f6939879d2..bd28f386bd02020ef3adc4295a90021d6d43a0f7 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
 #include <linux/rculist.h>
+#include <linux/err.h>
 
 #include <net/sock.h>
 #include <net/ip.h>
@@ -61,8 +62,7 @@
 #include <net/ip6_route.h>
 #endif
 
-static unsigned int ip_tunnel_hash(struct ip_tunnel_net *itn,
-                                  __be32 key, __be32 remote)
+static unsigned int ip_tunnel_hash(__be32 key, __be32 remote)
 {
        return hash_32((__force u32)key ^ (__force u32)remote,
                         IP_TNL_HASH_BITS);
@@ -204,7 +204,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
        struct ip_tunnel *t, *cand = NULL;
        struct hlist_head *head;
 
-       hash = ip_tunnel_hash(itn, key, remote);
+       hash = ip_tunnel_hash(key, remote);
        head = &itn->tunnels[hash];
 
        hlist_for_each_entry_rcu(t, head, hash_node) {
@@ -236,7 +236,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
                        cand = t;
        }
 
-       hash = ip_tunnel_hash(itn, key, 0);
+       hash = ip_tunnel_hash(key, 0);
        head = &itn->tunnels[hash];
 
        hlist_for_each_entry_rcu(t, head, hash_node) {
@@ -292,7 +292,7 @@ static struct hlist_head *ip_bucket(struct ip_tunnel_net *itn,
        else
                remote = 0;
 
-       h = ip_tunnel_hash(itn, parms->i_key, remote);
+       h = ip_tunnel_hash(parms->i_key, remote);
        return &itn->tunnels[h];
 }
 
@@ -687,6 +687,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
                                tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
                        tunnel->err_count--;
 
+                       memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
                        dst_link_failure(skb);
                } else
                        tunnel->err_count = 0;
@@ -930,7 +931,7 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
        }
        rtnl_unlock();
 
-       return PTR_RET(itn->fb_tunnel_dev);
+       return PTR_ERR_OR_ZERO(itn->fb_tunnel_dev);
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_init_net);