ip_tunnel: Fix dst ref-count.
authorPravin B Shelar <pshelar@nicira.com>
Mon, 24 Mar 2014 05:06:36 +0000 (22:06 -0700)
committerJiri Slaby <jslaby@suse.cz>
Fri, 18 Apr 2014 09:07:11 +0000 (11:07 +0200)
[ Upstream commit fbd02dd405d0724a0f25897ed4a6813297c9b96f ]

Commit 10ddceb22ba (ip_tunnel:multicast process cause panic due
to skb->_skb_refdst NULL pointer) removed dst-drop call from
ip-tunnel-recv.

Following commit reintroduce dst-drop and fix the original bug by
checking loopback packet before releasing dst.
Original bug: https://bugzilla.kernel.org/show_bug.cgi?id=70681

CC: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/ipv4/gre_demux.c
net/ipv4/ip_tunnel.c
net/ipv4/ip_tunnel_core.c

index 736c9fc3ef93c0f2de02658997782f7af011c122..0c0c1f09fd171b5f3d5db7484ae49cfb79d8d70a 100644 (file)
@@ -211,6 +211,14 @@ static int gre_cisco_rcv(struct sk_buff *skb)
        int i;
        bool csum_err = false;
 
+#ifdef CONFIG_NET_IPGRE_BROADCAST
+       if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
+               /* Looped back packet, drop it! */
+               if (rt_is_output_route(skb_rtable(skb)))
+                       goto drop;
+       }
+#endif
+
        if (parse_gre_header(skb, &tpi, &csum_err) < 0)
                goto drop;
 
index 995a0bb33a6570dd0578945c30d785707d4aecce..3bedb26cfb5380ac4956e5f0bb30a18f555fda5e 100644 (file)
@@ -411,9 +411,6 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
 
 #ifdef CONFIG_NET_IPGRE_BROADCAST
        if (ipv4_is_multicast(iph->daddr)) {
-               /* Looped back packet, drop it! */
-               if (rt_is_output_route(skb_rtable(skb)))
-                       goto drop;
                tunnel->dev->stats.multicast++;
                skb->pkt_type = PACKET_BROADCAST;
        }
index ba22cc3a5a53d2c1992c1f3cc241da0c73f86cba..c31e3ad98ef28e91eff2679d6976d4c20c055410 100644 (file)
@@ -109,6 +109,7 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto)
        secpath_reset(skb);
        if (!skb->l4_rxhash)
                skb->rxhash = 0;
+       skb_dst_drop(skb);
        skb->vlan_tci = 0;
        skb_set_queue_mapping(skb, 0);
        skb->pkt_type = PACKET_HOST;