Skip to contentSkip to conversation

ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation

PATCH Applied Yohei Kanemaru 2 participants 2 messages Jan 29, 2019 – Jan 30, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation

skb->cb may contain data from previous layers (in an observed case IPv4 with L3 Master Device). In the observed scenario, the data in IPCB(skb)->frags was misinterpreted as IP6CB(skb)->frag_max_size, eventually caused an unexpected IPv6 fragmentation in ip6_fragment() through ip6_finish_output().

This patch clears IP6CB(skb), which potentially contains garbage data, on the SRH ip4ip6 encapsulation.

Fixes 32d99d0b6702 ("ipv6: sr: add support for ip4ip6 encapsulation")
---
 net/ipv6/seg6_iptunnel.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv6/seg6_iptunnel.c +2 -0
index 8181ee7..ee5403c 100644
@@ -146,6 +146,8 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto)
 	} else {
 		ip6_flow_hdr(hdr, 0, flowlabel);
 		hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));
+
+		memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
 	}
 
 	hdr->nexthdr = NEXTHDR_ROUTING;
Signature · 1 line
2.10.0
maintainer Applied
#1 lore raw

From: Yohei Kanemaru <[email protected]>
Date: Tue, 29 Jan 2019 15:52:34 +0900

Quoted 11 lines

skb->cb may contain data from previous layers (in an observed case IPv4 with L3 Master Device). In the observed scenario, the data in IPCB(skb)->frags was misinterpreted as IP6CB(skb)->frag_max_size, eventually caused an unexpected IPv6 fragmentation in ip6_fragment() through ip6_finish_output().

This patch clears IP6CB(skb), which potentially contains garbage data, on the SRH ip4ip6 encapsulation.

Fixes 32d99d0b6702 ("ipv6: sr: add support for ip4ip6 encapsulation")

Applied, thanks.