mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
net: cdc_ether: fix divide by 0 on bad descriptors
commit 2cb80187ba 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
46bdabbca0
commit
caeeef8438
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user