[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD008B9C8@AcuExch.aculab.com>
Date: Fri, 6 Oct 2017 09:38:50 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'William Tu' <u9012063@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Xin Long <lucien.xin@...il.com>
Subject: RE: [PATCH net-next] ip_gre: check packet length and mtu correctly
in erspan_fb_xmit
From: William Tu
> Sent: 05 October 2017 22:21
...
> >> - if (skb->len > dev->mtu) {
> >> + if (skb->len - dev->hard_header_len > dev->mtu) {
> >
> > Can you guarantee that skb->len > dev_hard_header_len?
> > It is probably safer to check skb->len > dev->hard_header_len + dev->mtu
> > since that addition isn't going to overflow.
> Sure, I will fix it.
>
> >
> >> pskb_trim(skb, dev->mtu);
> >> truncate = true;
> >
> > Is that pskb_trim() now truncating to the correct size?
>
> You're right, now I should truncate to (dev->mtu + dev_hard_header_len)
It might be worth caching that length in the dev structure
to avoid the arithmetic on every packet.
David
Powered by blists - more mailing lists