diff options
author | Bjørn Mork <bjorn@mork.no> | 2017-11-06 15:37:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-21 09:21:18 +0100 |
commit | caeeef8438c30e7d0e43293fcb7beb9f953bb2a9 (patch) | |
tree | 45cd5da4b1f5aa754b1fc8ec4d58d47f135acf4c | |
parent | 46bdabbca02ebabd292d0ea3f610aa54e53f0e25 (diff) | |
download | linux-stable-caeeef8438c30e7d0e43293fcb7beb9f953bb2a9.tar.gz linux-stable-caeeef8438c30e7d0e43293fcb7beb9f953bb2a9.tar.bz2 linux-stable-caeeef8438c30e7d0e43293fcb7beb9f953bb2a9.zip |
net: cdc_ether: fix divide by 0 on bad descriptors
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>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 8c408aa2f208..f9343bee1de3 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -221,7 +221,7 @@ skip: goto bad_desc; } - if (header.usb_cdc_ether_desc) { + if (header.usb_cdc_ether_desc && 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. |