diff options
author | Oliver Neukum <oneukum@suse.com> | 2016-01-07 11:01:00 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-09 21:00:24 -0500 |
commit | 29c6dd591bbd592472247441de9fa694acdabae8 (patch) | |
tree | 276191fdf11533c762892bd326547731c1dfdebb /drivers/net/usb | |
parent | 5ee3c60c8d3b88cab6496c9b7d49a01576dd9cf9 (diff) | |
download | op-kernel-dev-29c6dd591bbd592472247441de9fa694acdabae8.zip op-kernel-dev-29c6dd591bbd592472247441de9fa694acdabae8.tar.gz |
cdc-acm: fix NULL pointer reference
The union descriptor must be checked. Its usage was conditional
before the parser was introduced. This is important, because
many RNDIS device, which also use the common parser, have
bogus extra descriptors.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Tested-by: Vasily Galkin <galkin-vv@yandex.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 3da70bf..7cba2c3 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -160,6 +160,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) info->u = header.usb_cdc_union_desc; info->header = header.usb_cdc_header_desc; info->ether = header.usb_cdc_ether_desc; + if (!info->u) { + if (rndis) + goto skip; + else /* in that case a quirk is mandatory */ + goto bad_desc; + } /* we need a master/control interface (what we're * probed with) and a slave/data interface; union * descriptors sort this all out. @@ -256,7 +262,7 @@ skip: goto bad_desc; } - } else if (!info->header || !info->u || (!rndis && !info->ether)) { + } else if (!info->header || (!rndis && !info->ether)) { dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n", info->header ? "" : "header ", info->u ? "" : "union ", |