Skip to contentSkip to conversation

ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called

PATCH Superseded Duan Jiong 3 participants 5 messages Jan 21, 2014 – Jan 23, 2014

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called

commit a622260254ee48("ip_tunnel: fix kernel panic with icmp_dest_unreach") clear IPCB in ip_tunnel_xmit() , or else skb->cb[] may contain garbage from GSO segmentation layer.

But commit 0e6fbc5b6c621("ip_tunnels: extend iptunnel_xmit()") refactor codes, and it clear IPCB behind the dst_link_failure().

So clear IPCB in ip_tunnel_xmit() just like commti a622260254ee48("ip_tunnel:
fix kernel panic with icmp_dest_unreach").

---
 net/ipv4/ip_tunnel.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/ip_tunnel.c +1 -0
index 90ff957..dda1e9a 100644
@@ -535,6 +535,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
 
 	inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
 
+	memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
 	dst = tnl_params->daddr;
 	if (dst == 0) {
 		/* NBMA tunnel */
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Duan Jiong

commit a622260254ee48("ip_tunnel: fix kernel panic with icmp_dest_unreach") clear IPCB in ip_tunnel_xmit() , or else skb->cb[] may contain garbage from GSO segmentation layer.

But commit 0e6fbc5b6c621("ip_tunnels: extend iptunnel_xmit()") refactor codes, and it clear IPCB behind the dst_link_failure().

ok.

Quoted 13 lines

So clear IPCB in ip_tunnel_xmit() just like commti a622260254ee48("ip_tunnel:
fix kernel panic with icmp_dest_unreach").

---
 net/ipv4/ip_tunnel.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/ip_tunnel.c +0 -0
index 90ff957..dda1e9a 100644

net/ipv4/ip_tunnel.c void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, · line 541

Quoted 7 lines
net/ipv4/ip_tunnel.c +1 -0
@@ -535,6 +535,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
 
        inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
 
+       memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
        dst = tnl_params->daddr;
        if (dst == 0) {
                /* NBMA tunnel */

Can you clear IPCB in error path for dst_link_failure(). So that we do not clear it twice in fast path.

maintainer
#2 lore raw

From: Pravin Shelar <[email protected]>
Date: Tue, 21 Jan 2014 10:33:36 -0800

Quoted 2 lines

Can you clear IPCB in error path for dst_link_failure(). So that we do not clear it twice in fast path.

Indeed, please add this memset() before the dst_link_failure() call.

Thanks.

author
#3 lore raw

PATCH v2 1/1 ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called

commit a622260254ee48("ip_tunnel: fix kernel panic with icmp_dest_unreach") clear IPCB in ip_tunnel_xmit() , or else skb->cb[] may contain garbage from GSO segmentation layer.

But commit 0e6fbc5b6c621("ip_tunnels: extend iptunnel_xmit()") refactor codes, and it clear IPCB behind the dst_link_failure().

So clear IPCB in ip_tunnel_xmit() just like commti a622260254ee48("ip_tunnel:
fix kernel panic with icmp_dest_unreach").

---

v2: add the memset() before the dst_link_failure() call

 net/ipv4/ip_tunnel.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/ip_tunnel.c +1 -0
index 90ff957..471c8c1 100644
@@ -618,6 +618,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;
Signature · 1 line
1.8.3.1
maintainer
#4 lore raw

From: Duan Jiong <[email protected]>
Date: Thu, 23 Jan 2014 14:00:25 +0800

Quoted 5 lines

commit a622260254ee48("ip_tunnel: fix kernel panic with icmp_dest_unreach") clear IPCB in ip_tunnel_xmit() , or else skb->cb[] may contain garbage from GSO segmentation layer.

Quoted 7 lines

But commit 0e6fbc5b6c621("ip_tunnels: extend iptunnel_xmit()") refactor codes, and it clear IPCB behind the dst_link_failure().

So clear IPCB in ip_tunnel_xmit() just like commti a622260254ee48("ip_tunnel:
fix kernel panic with icmp_dest_unreach").

Applied and queued up for -stable, thanks.