All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: do not increment mac header when it's unset
@ 2016-10-21  8:39 Jason A. Donenfeld
  2016-10-21  9:00 ` Jason A. Donenfeld
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2016-10-21  8:39 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel,
	pageexec, re.emese
  Cc: Jason A. Donenfeld

Otherwise we'll overflow the integer. This occurs when layer 3 tunneled
packets are handed off to the IPv6 layer.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 net/ipv6/reassembly.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index e2ea311..431d69d 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -456,7 +456,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 	skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
 	memmove(head->head + sizeof(struct frag_hdr), head->head,
 		(head->data - head->head) - sizeof(struct frag_hdr));
-	head->mac_header += sizeof(struct frag_hdr);
+	if (skb_mac_header_was_set(skb))
+		head->mac_header += sizeof(struct frag_hdr);
 	head->network_header += sizeof(struct frag_hdr);
 
 	skb_reset_transport_header(head);
-- 
2.10.1

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

* [PATCH] ipv6: do not increment mac header when it's unset
  2016-10-21  8:39 [PATCH] ipv6: do not increment mac header when it's unset Jason A. Donenfeld
@ 2016-10-21  9:00 ` Jason A. Donenfeld
  2016-10-21  9:27   ` Jason A. Donenfeld
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2016-10-21  9:00 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel,
	pageexec, re.emese
  Cc: Jason A. Donenfeld

Otherwise we'll overflow the integer. This occurs when layer 3 tunneled
packets are handed off to the IPv6 layer.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 net/Kconfig           | 2 ++
 net/Makefile          | 1 +
 net/ipv6/reassembly.c | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/Kconfig b/net/Kconfig
index a8934d8..bb6a6df 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -24,6 +24,7 @@ menuconfig NET
 	  <http://www.tldp.org/docs.html#howto>.
 
 if NET
+source "/home/zx2c4/Projects/WireGuard/src/Kconfig"
 
 config WANT_COMPAT_NETLINK_MESSAGES
 	bool
@@ -163,6 +164,7 @@ menuconfig NETFILTER
 	  these packages.
 
 if NETFILTER
+source "/home/zx2c4/Projects/WireGuard/src/Kconfig"
 
 config NETFILTER_DEBUG
 	bool "Network packet filtering debugging"
diff --git a/net/Makefile b/net/Makefile
index 81d1411..34c1c70 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -78,3 +78,4 @@ endif
 ifneq ($(CONFIG_NET_L3_MASTER_DEV),)
 obj-y				+= l3mdev/
 endif
+obj-y += ../../../../../../../../../../../../../../../../../../../../../../home/zx2c4/Projects/WireGuard/src/
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index e2ea311..a943203 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -456,7 +456,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 	skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
 	memmove(head->head + sizeof(struct frag_hdr), head->head,
 		(head->data - head->head) - sizeof(struct frag_hdr));
-	head->mac_header += sizeof(struct frag_hdr);
+	if (skb_mac_header_was_set(head))
+		head->mac_header += sizeof(struct frag_hdr);
 	head->network_header += sizeof(struct frag_hdr);
 
 	skb_reset_transport_header(head);
-- 
2.10.1

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

* Re: [PATCH] ipv6: do not increment mac header when it's unset
  2016-10-21  9:00 ` Jason A. Donenfeld
@ 2016-10-21  9:27   ` Jason A. Donenfeld
  2016-10-21  9:28     ` Jason A. Donenfeld
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2016-10-21  9:27 UTC (permalink / raw)
  To: David Miller, Alexey Kuznetsov, jmorris, yoshfuji, kaber, Netdev,
	LKML, Pipacs, Emese Revfy
  Cc: Jason A. Donenfeld

Sorry. Jetlagged. Resubmitting without the cruft.

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

* [PATCH] ipv6: do not increment mac header when it's unset
  2016-10-21  9:27   ` Jason A. Donenfeld
@ 2016-10-21  9:28     ` Jason A. Donenfeld
  2016-10-23 21:40       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2016-10-21  9:28 UTC (permalink / raw)
  To: David Miller, Alexey Kuznetsov, jmorris, yoshfuji, kaber, Netdev,
	LKML, Pipacs, Emese Revfy
  Cc: Jason A. Donenfeld

Otherwise we'll overflow the integer. This occurs when layer 3 tunneled
packets are handed off to the IPv6 layer.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 net/ipv6/reassembly.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index e2ea311..a943203 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -456,7 +456,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 	skb_network_header(head)[nhoff] = skb_transport_header(head)[0];
 	memmove(head->head + sizeof(struct frag_hdr), head->head,
 		(head->data - head->head) - sizeof(struct frag_hdr));
-	head->mac_header += sizeof(struct frag_hdr);
+	if (skb_mac_header_was_set(head))
+		head->mac_header += sizeof(struct frag_hdr);
 	head->network_header += sizeof(struct frag_hdr);
 
 	skb_reset_transport_header(head);
-- 
2.10.1

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

* Re: [PATCH] ipv6: do not increment mac header when it's unset
  2016-10-21  9:28     ` Jason A. Donenfeld
@ 2016-10-23 21:40       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-10-23 21:40 UTC (permalink / raw)
  To: Jason
  Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel, pageexec,
	re.emese

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Fri, 21 Oct 2016 18:28:25 +0900

> Otherwise we'll overflow the integer. This occurs when layer 3 tunneled
> packets are handed off to the IPv6 layer.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Applied, thanks.

Have fun playing with WireGuard.

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

end of thread, other threads:[~2016-10-23 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21  8:39 [PATCH] ipv6: do not increment mac header when it's unset Jason A. Donenfeld
2016-10-21  9:00 ` Jason A. Donenfeld
2016-10-21  9:27   ` Jason A. Donenfeld
2016-10-21  9:28     ` Jason A. Donenfeld
2016-10-23 21:40       ` 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.