netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] nsh: set mac len based on inner packet
@ 2018-07-11 16:00 Willem de Bruijn
  2018-07-11 16:00 ` [PATCH net] packet: reset network header if packet shorter than ll reserved space Willem de Bruijn
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Willem de Bruijn @ 2018-07-11 16:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

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: c411ed854584 ("nsh: add GSO support")
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 net/nsh/nsh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c
index 9696ef96b719..1a30e165eeb4 100644
--- a/net/nsh/nsh.c
+++ b/net/nsh/nsh.c
@@ -104,7 +104,7 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
 	__skb_pull(skb, nsh_len);
 
 	skb_reset_mac_header(skb);
-	skb_reset_mac_len(skb);
+	skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0;
 	skb->protocol = proto;
 
 	features &= NETIF_F_SG;
-- 
2.18.0.203.gfac676dfb9-goog

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

end of thread, other threads:[~2018-07-13  0:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 16:00 [PATCH net] nsh: set mac len based on inner packet Willem de Bruijn
2018-07-11 16:00 ` [PATCH net] packet: reset network header if packet shorter than ll reserved space Willem de Bruijn
2018-07-12 23:57   ` David Miller
2018-07-11 16:00 ` [PATCH net] selftests: in udpgso_bench do not test udp zerocopy Willem de Bruijn
2018-07-12 23:57   ` David Miller
2018-07-12  7:28 ` [PATCH net] nsh: set mac len based on inner packet Jiri Benc
2018-07-12 23:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).