All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation
@ 2019-01-29  6:52 Yohei Kanemaru
  2019-01-30 22:06 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yohei Kanemaru @ 2019-01-29  6:52 UTC (permalink / raw)
  To: netdev, davem, dlebrun; +Cc: Yohei Kanemaru

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")
Signed-off-by: Yohei Kanemaru <yohei.kanemaru@gmail.com>
---
 net/ipv6/seg6_iptunnel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index 8181ee7..ee5403c 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -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;
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation
  2019-01-29  6:52 [PATCH net] ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation Yohei Kanemaru
@ 2019-01-30 22:06 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-01-30 22:06 UTC (permalink / raw)
  To: yohei.kanemaru; +Cc: netdev, dlebrun

From: Yohei Kanemaru <yohei.kanemaru@gmail.com>
Date: Tue, 29 Jan 2019 15:52:34 +0900

> 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")
> Signed-off-by: Yohei Kanemaru <yohei.kanemaru@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-30 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29  6:52 [PATCH net] ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation Yohei Kanemaru
2019-01-30 22:06 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.