lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALDO+SYDGtipnsXOmcFmCRB2QcgjjzoWVB=T71=r7U834ivPjg@mail.gmail.com>
Date:   Fri, 6 Oct 2017 15:09:29 -0700
From:   William Tu <u9012063@...il.com>
To:     David Laight <David.Laight@...lab.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

On Fri, Oct 6, 2017 at 2:38 AM, David Laight <David.Laight@...lab.com> wrote:
> 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
>
Thanks for the advise.
Yes, adding another field in the struct net_device can avoid the
arithmetic operation. I'm not sure it's a good idea to add new field
since there are already a lot in net_device.  Let's wait to see how
others think.

William

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ