Skip to content

Commit b124e97

Browse files
wdebruijgregkh
authored andcommitted
nsh: set mac len based on inner packet
commit bab2c80 upstream. When pulling the NSH header in nsh_gso_segment, set the mac length based on the encapsulated packet type. skb_reset_mac_len computes an offset to the network header, which here still points to the outer packet: > skb_reset_network_header(skb); > [...] > __skb_pull(skb, nsh_len); > skb_reset_mac_header(skb); // now mac hdr starts nsh_len == 8B after net hdr > skb_reset_mac_len(skb); // mac len = net hdr - mac hdr == (u16) -8 == 65528 > [..] > skb_mac_gso_segment(skb, ..) Link: http://lkml.kernel.org/r/CAF=yD-KeAcTSOn4AxirAxL8m7QAS8GBBe1w09eziYwvPbbUeYA@mail.gmail.com Reported-by: syzbot+7b9ed9872dab8c32305d@syzkaller.appspotmail.com Fixes: c411ed8 ("nsh: add GSO support") Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 00235ab commit b124e97

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/nsh/nsh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
4242
__skb_pull(skb, nsh_len);
4343

4444
skb_reset_mac_header(skb);
45-
skb_reset_mac_len(skb);
45+
skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0;
4646
skb->protocol = proto;
4747

4848
features &= NETIF_F_SG;

0 commit comments

Comments
 (0)