linux/drivers/net/usb
Bjørn Mork 7fd0783372 net: qmi_wwan: fix divide by 0 on bad descriptors
A CDC Ethernet functional descriptor with wMaxSegmentSize = 0 will
cause a divide error in usbnet_probe:

divide error: 0000 [#1] PREEMPT SMP KASAN
Modules linked in:
CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.0-rc8-44453-g1fdc1a82c34f #56
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
task: ffff88006bef5c00 task.stack: ffff88006bf60000
RIP: 0010:usbnet_update_max_qlen+0x24d/0x390 drivers/net/usb/usbnet.c:355
RSP: 0018:ffff88006bf67508 EFLAGS: 00010246
RAX: 00000000000163c8 RBX: ffff8800621fce40 RCX: ffff8800621fcf34
RDX: 0000000000000000 RSI: ffffffff837ecb7a RDI: ffff8800621fcf34
RBP: ffff88006bf67520 R08: ffff88006bef5c00 R09: ffffed000c43f881
R10: ffffed000c43f880 R11: ffff8800621fc406 R12: 0000000000000003
R13: ffffffff85c71de0 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88006ca00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe9c0d6dac CR3: 00000000614f4000 CR4: 00000000000006f0
Call Trace:
 usbnet_probe+0x18b5/0x2790 drivers/net/usb/usbnet.c:1783
 qmi_wwan_probe+0x133/0x220 drivers/net/usb/qmi_wwan.c:1338
 usb_probe_interface+0x324/0x940 drivers/usb/core/driver.c:361
 really_probe drivers/base/dd.c:413
 driver_probe_device+0x522/0x740 drivers/base/dd.c:557

Fix by simply ignoring the bogus descriptor, as it is optional
for QMI devices anyway.

Fixes: 423ce8caab ("net: usb: qmi_wwan: New driver for Huawei QMI based WWAN devices")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-11-08 13:42:43 +09:00
..
asix_common.c asix: Fix small memory leak in ax88772_unbind() 2017-08-07 10:10:19 -07:00
asix_devices.c net: usb: asix: fill null-ptr-deref in asix_suspend 2017-11-04 22:42:09 +09:00
asix.h asix: Fix small memory leak in ax88772_unbind() 2017-08-07 10:10:19 -07:00
ax88172a.c net: usbnet: support 64bit stats 2017-04-03 19:09:40 -07:00
ax88179_178a.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-30 12:43:08 -04:00
catc.c net: usb: catc: constify usb_device_id and fix space before '[' error 2017-08-08 17:47:58 -07:00
cdc_eem.c
cdc_ether.c net: cdc_ether: fix divide by 0 on bad descriptors 2017-11-08 13:42:01 +09:00
cdc_mbim.c net: cdc_mbim: apply "NDP to end" quirk to HP lt4132 2017-07-03 02:19:36 -07:00
cdc_ncm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
cdc_subset.c
cdc-phonet.c net: usb: cdc-phonet: constify usb_device_id 2017-08-08 17:47:58 -07:00
ch9200.c net: ch9200: add missing USB-descriptor endianness conversions 2017-05-12 12:15:46 -04:00
cx82310_eth.c cx82310_eth: use skb_cow_head() to deal with cloned skbs 2017-04-21 13:24:05 -04:00
dm9601.c net: usbnet: support 64bit stats 2017-04-03 19:09:40 -07:00
gl620a.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
hso.c net: manual clean code which call skb_put_[data:zero] 2017-06-20 13:30:15 -04:00
huawei_cdc_ncm.c cdc_ncm: Set NTB format again after altsetting switch for Huawei devices 2017-07-14 08:15:05 -07:00
int51x1.c net: introduce __skb_put_[zero, data, u8] 2017-06-20 13:30:14 -04:00
ipheth.c net: usb: ipheth: constify usb_device_id 2017-08-08 17:47:58 -07:00
kalmia.c networking: convert many more places to skb_put_zero() 2017-06-16 11:48:35 -04:00
kaweth.c net: usb: kaweth: constify usb_device_id 2017-08-08 17:47:59 -07:00
Kconfig usb: plusb: Add support for PL-27A1 2017-04-25 10:08:16 -04:00
lan78xx.c lan78xx: Use default values loaded from EEPROM/OTP after reset 2017-09-21 15:22:53 -07:00
lan78xx.h lan78xx: add LAN7801 MAC only support 2016-12-08 14:21:47 -05:00
lg-vl600.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mcs7830.c net: usbnet: support 64bit stats 2017-04-03 19:09:40 -07:00
net1080.c networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
pegasus.c usbnet: pegasus: Use net_device_stats from struct net_device 2017-04-07 07:03:33 -07:00
pegasus.h usbnet: pegasus: Use net_device_stats from struct net_device 2017-04-07 07:03:33 -07:00
plusb.c usb: plusb: Add support for PL-27A1 2017-04-25 10:08:16 -04:00
qmi_wwan.c net: qmi_wwan: fix divide by 0 on bad descriptors 2017-11-08 13:42:43 +09:00
r8152.c drivers/net/usb: add device id for TP-LINK UE300 USB 3.0 Ethernet 2017-10-24 18:31:14 +09:00
rndis_host.c rndis_host: support Novatel Verizon USB730L 2017-10-03 14:30:46 -07:00
rtl8150.c net: usb: rtl8150: constify usb_device_id 2017-08-08 17:47:59 -07:00
sierra_net.c net: usbnet: support 64bit stats 2017-04-03 19:09:40 -07:00
smsc75xx.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-04-21 20:23:53 -07:00
smsc75xx.h
smsc95xx.c smsc95xx: Configure pause time to 0xffff when tx flow control enabled 2017-09-12 20:36:30 -07:00
smsc95xx.h smsc95xx: Add comments to the registers definition 2017-04-17 13:04:52 -04:00
sr9700.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-04-21 20:23:53 -07:00
sr9700.h
sr9800.c net: usbnet: support 64bit stats 2017-04-03 19:09:40 -07:00
sr9800.h
usbnet.c net/{mii, smsc}: Make mii_ethtool_get_link_ksettings and smc_netdev_get_ecmd return void 2017-06-05 11:00:42 -04:00
zaurus.c networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00