Commit 29c6dd59 authored by Oliver Neukum's avatar Oliver Neukum Committed by David S. Miller

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: default avatarOliver Neukum <oneukum@suse.com>
Tested-by: default avatarVasily Galkin <galkin-vv@yandex.ru>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5ee3c60c
...@@ -160,6 +160,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -160,6 +160,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
info->u = header.usb_cdc_union_desc; info->u = header.usb_cdc_union_desc;
info->header = header.usb_cdc_header_desc; info->header = header.usb_cdc_header_desc;
info->ether = header.usb_cdc_ether_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 /* we need a master/control interface (what we're
* probed with) and a slave/data interface; union * probed with) and a slave/data interface; union
* descriptors sort this all out. * descriptors sort this all out.
...@@ -256,7 +262,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -256,7 +262,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
goto bad_desc; 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", dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
info->header ? "" : "header ", info->header ? "" : "header ",
info->u ? "" : "union ", info->u ? "" : "union ",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment