summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2017-11-06 15:37:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-24 08:33:40 +0100
commitf376621861e3d8a713d6931f4363c4137912330b (patch)
tree806b9c145e42daaf2a7e4ca664a19298712c4e66 /drivers
parent6f239c0655cfe90c3e048bccb2e74ab1780cabba (diff)
net: cdc_ether: fix divide by 0 on bad descriptors
[ Upstream commit 2cb80187ba065d7decad7c6614e35e07aec8a974 ] 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/usb/cdc_ether.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index b82be816256c..1fca0024f294 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.