Skip to content

Commit

Permalink
USB: cdc-acm: Fixing crash when ACM probing interfaces with no endpoi…
Browse files Browse the repository at this point in the history
…nt descriptors.

Certain USB devices, such as the Nokia X6 mobile phone, don't expose any
endpoint descriptors on some of their interfaces. If the ACM driver is forced
to probe all interfaces on a device the a NULL pointer dereference will occur
when the ACM driver attempts to use the endpoint of the alternative settings.
One way to get the ACM driver to probe all the interfaces is by using the
/sys/bus/usb/drivers/cdc_acm/new_id interface.

This patch checks that the endpoint pointer for the current alternate settings
is non-NULL before using it.

Signed-off-by: Toby Gray <toby.gray@realvnc.com>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Toby Gray authored and Greg Kroah-Hartman committed Sep 4, 2010
1 parent 5b239f0 commit 577045c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,8 @@ static int acm_probe(struct usb_interface *intf,
}

if (!buflen) {
if (intf->cur_altsetting->endpoint->extralen &&
if (intf->cur_altsetting->endpoint &&
intf->cur_altsetting->endpoint->extralen &&
intf->cur_altsetting->endpoint->extra) {
dev_dbg(&intf->dev,
"Seeking extra descriptors on endpoint\n");
Expand Down

0 comments on commit 577045c

Please sign in to comment.