linux/drivers/net/usb
Bjørn Mork 6527f833bf net: cdc_ncm: fix NULL pointer deref in cdc_ncm_bind_common
Commit 77b0a09967 ("cdc-ncm: use common parser") added a dangerous
new trust in the CDC functional descriptors presented by the device,
unconditionally assuming that any device handled by the driver has
a CDC Union descriptor.

This descriptor is required by the NCM and MBIM specs, but crashing
on non-compliant devices is still unacceptable. Not only will that
allow malicious devices to crash the kernel, but in this case it is
also well known that there are non-compliant real devices on the
market - as shown by the comment accompanying the IAD workaround
in the same function.

The Sierra Wireless EM7305 is an example of such device, having
a CDC header and a CDC MBIM descriptor but no CDC Union:

    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber       12
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass     14
      bInterfaceProtocol      0
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC MBIM:
        bcdMBIMVersion       1.00
        wMaxControlMessage   4096
        bNumberFilters       16
        bMaxFilterSize       128
        wMaxSegmentSize      4064
        bmNetworkCapabilities 0x20
          8-byte ntb input size
      Endpoint Descriptor:
	..

The conversion to a common parser also left the local cdc_union
variable untouched.  This caused the IAD workaround code to be applied
to all devices with an IAD descriptor, which was never intended.  Finish
the conversion by testing for hdr.usb_cdc_union_desc instead.

Cc: Oliver Neukum <oneukum@suse.com>
Fixes: 77b0a09967 ("cdc-ncm: use common parser")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-11-24 14:26:16 -05:00
..
asix_common.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
asix_devices.c net: asix: add support for the Billionton GUSB2AM-1G-B USB adapter 2015-10-18 19:36:04 -07:00
asix.h asix: Rename remaining and size for clarity 2015-10-05 06:58:38 -07:00
ax88172a.c
ax88179_178a.c
catc.c
cdc_eem.c
cdc_ether.c net: usb: cdc_ether: add Dell DW5580 as a mobile broadband adapter 2015-11-16 14:58:39 -05:00
cdc_mbim.c ipv6: remove unused neigh parameter from ndisc functions 2015-09-24 12:26:08 -07:00
cdc_ncm.c net: cdc_ncm: fix NULL pointer deref in cdc_ncm_bind_common 2015-11-24 14:26:16 -05:00
cdc_subset.c
cdc-phonet.c cdc-phonet: use common parser 2015-09-15 12:43:49 -07:00
ch9200.c ch9200: Convert to use module_usb_driver 2015-09-22 17:34:57 -07:00
cx82310_eth.c
dm9601.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
gl620a.c
hso.c
huawei_cdc_ncm.c cdc_ncm: Add support for moving NDP to end of NCM frame 2015-07-09 14:58:31 -07:00
int51x1.c
ipheth.c
kalmia.c
kaweth.c kaweth: remove ifdefed out call to dma_supported 2015-11-10 16:32:11 -08:00
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-20 06:08:27 -07:00
lan78xx.c lan78xx: Return 0 when lan78xx_suspend() has no error. 2015-09-28 22:28:53 -07:00
lan78xx.h lan78xx: Remove not defined MAC_CR_GMII_EN_ bit from MAC_CR. 2015-09-17 22:15:37 -07:00
lg-vl600.c
Makefile usbnet: New driver for QinHeng CH9200 devices 2015-09-21 16:16:16 -07:00
mcs7830.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
net1080.c
pegasus.c
pegasus.h
plusb.c
qmi_wwan.c net: qmi_wwan: add XS Stick W100-2 from 4G Systems 2015-11-18 23:01:32 -05:00
r8152.c r8152: fix the runtime suspend issues 2015-09-09 20:27:54 -07:00
rndis_host.c
rtl8150.c
sierra_net.c
smsc75xx.c usbnet: remove invalid check 2015-09-22 16:14:32 -07:00
smsc75xx.h
smsc95xx.c usbnet: remove invalid check 2015-09-22 16:14:32 -07:00
smsc95xx.h
sr9700.c
sr9700.h
sr9800.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
sr9800.h
usbnet.c usbnet: remove ifdefed out call to dma_supported 2015-11-10 16:32:11 -08:00
zaurus.c