ipv6: do not increment mac header when it's unset
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 21 Oct 2016 09:28:25 +0000 (18:28 +0900)
committerDavid S. Miller <davem@davemloft.net>
Sun, 23 Oct 2016 21:38:58 +0000 (17:38 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/reassembly.c

index 2160d5d009cb6e97f36f3b4319322fb52a354866..3815e8505ed2a3be767dae4ec9822d2152c4e72e 100644 (file)
@@ -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);