lkml.org 
[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 125/133] net: cdc_ether: fix divide by 0 on bad descriptors
    3.16.51-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Bjørn Mork <bjorn@mork.no>

    commit 2cb80187ba065d7decad7c6614e35e07aec8a974 upstream.

    Setting dev->hard_mtu to 0 will cause a divide error in
    usbnet_probe. Protect against devices with bogus CDC Ethernet
    functional descriptors by ignoring a zero wMaxSegmentSize.

    Signed-off-by: Bjørn Mork <bjorn@mork.no>
    Acked-by: Oliver Neukum <oneukum@suse.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: parsing code is organised differently]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    --- a/drivers/net/usb/cdc_ether.c
    +++ b/drivers/net/usb/cdc_ether.c
    @@ -235,8 +235,9 @@ int usbnet_generic_cdc_bind(struct usbne
    info->ether->bLength);
    goto bad_desc;
    }
    - dev->hard_mtu = le16_to_cpu(
    - info->ether->wMaxSegmentSize);
    + if (info->ether->wMaxSegmentSize)
    + dev->hard_mtu = le16_to_cpu(
    + info->ether->wMaxSegmentSize);
    /* because of Zaurus, we may be ignoring the host
    * side link address we were given.
    */
    \
     
     \ /
      Last update: 2017-11-22 03:49    [W:4.703 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site