From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: David Miller <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net,
Netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, Pipacs <pageexec@gmail.com>,
Emese Revfy <re.emese@gmail.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH] ipv6: do not increment mac header when it's unset
Date: Fri, 21 Oct 2016 18:28:25 +0900 [thread overview]
Message-ID: <20161021092825.28085-1-Jason@zx2c4.com> (raw)
In-Reply-To: <CAHmME9q5yDae6qXecKK-Cdw-91geRnvzYocg=ypFucH+9LVt_g@mail.gmail.com>
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
next prev parent reply other threads:[~2016-10-21 9:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 8:39 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 [this message]
2016-10-23 21:40 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161021092825.28085-1-Jason@zx2c4.com \
--to=jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pageexec@gmail.com \
--cc=re.emese@gmail.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®