Skip to content

Commit

Permalink
cdc-acm: fix NULL pointer reference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and David S. Miller committed Jan 10, 2016
1 parent 5ee3c60 commit 29c6dd5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/net/usb/cdc_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -256,7 +262,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
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 ",
Expand Down

0 comments on commit 29c6dd5

Please sign in to comment.