Skip to contentSkip to conversation

ip_tunnel:multicast process cause panic due to skb->_skb_refdst NULL pointer

PATCH In review Xin Long 2 participants 4 messages Feb 24, 2014 – Mar 1, 2014

Subsystems (3)
lore
Share & tools
lore

Xin Long

author
#0 lore raw

PATCH 1/1 ip_tunnel:multicast process cause panic due to skb->_skb_refdst NULL pointer

when ip_tunnel process multicast packets, it may check if the packet is looped back packet though 'rt_is_output_route(skb_rtable(skb))' in ip_tunnel_rcv(), but before that , skb->_skb_refdst has been dropped in iptunnel_pull_header(), so which leads to a panic.

fix the bug: https://bugzilla.kernel.org/show_bug.cgi?id=70681

---
 net/ipv4/ip_tunnel_core.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv4/ip_tunnel_core.c +0 -1
index 6156f4e..88b08aa 100644
@@ -108,7 +108,6 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto)
 	nf_reset(skb);
 	secpath_reset(skb);
 	skb_clear_hash_if_not_l4(skb);
-	skb_dst_drop(skb);
 	skb->vlan_tci = 0;
 	skb_set_queue_mapping(skb, 0);
 	skb->pkt_type = PACKET_HOST;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · Xin Long

when ip_tunnel process multicast packets, it may check if the packet is looped back packet though 'rt_is_output_route(skb_rtable(skb))' in ip_tunnel_rcv(), but before that , skb->_skb_refdst has been dropped in iptunnel_pull_header(), so which leads to a panic.

fix the bug: https://bugzilla.kernel.org/show_bug.cgi?id=70681

If the packet is locally forwarded we can test for IPCB(skb)->flags & IPSKB_FORWARDED.

I am not sure if we actually have the correct dst at that point.

Greetings,

Hannes

author
#2 lore raw
Quoted 4 lines · Hannes Frederic Sowa

If the packet is locally forwarded we can test for IPCB(skb)->flags & IPSKB_FORWARDED.

thanks for your reply, hannes

IPSKB_FORWARDED is locally forwarded flag, but in ip_tunnel_rcv(), it check if the packet
is a *looped back packet* (not about locally forwarded), the path is __ip_route_output_key()--> __mkroute_output()(rth->dst.output = ip_mc_output), then, ip_mc_output()-->dev_loopback_xmit(),
which happen when inet_sk(sk)->mc_loop =1, and in __mkroute_output(),
rth->rt_is_input = 0.
In that path, IPCB(skb)->flags &IPSKB_FORWARDED always 0.

so I think 'IPCB(skb)->flags &IPSKB_FORWARDED' cannot meet the goal.

#3 lore raw
Quoted 19 lines · lucien xin
Quoted 4 lines · Hannes Frederic Sowa

If the packet is locally forwarded we can test for IPCB(skb)->flags & IPSKB_FORWARDED.

thanks for your reply, hannes

IPSKB_FORWARDED is locally forwarded flag, but in ip_tunnel_rcv(), it check if the packet
is a *looped back packet* (not about locally forwarded), the path is __ip_route_output_key()--> __mkroute_output()(rth->dst.output = ip_mc_output), then, ip_mc_output()-->dev_loopback_xmit(),
which happen when inet_sk(sk)->mc_loop =1, and in __mkroute_output(),
rth->rt_is_input = 0.
In that path, IPCB(skb)->flags &IPSKB_FORWARDED always 0.

Quoted 1 line

so I think 'IPCB(skb)->flags &IPSKB_FORWARDED' cannot meet the goal.

Ok, I see, sorry for the wrong hint, you're absolutely correct.

It seems to me that your original proposal is fine for me.

You would have to repost so it gets back into patchworks.

Thanks,

Hannes