1 From 577045c0a76e34294f902a7d5d60e90b04d094d0 Mon Sep 17 00:00:00 2001
2 From: Toby Gray <toby.gray@realvnc.com>
3 Date: Thu, 2 Sep 2010 10:46:20 +0100
4 Subject: USB: cdc-acm: Fixing crash when ACM probing interfaces with no endpoint descriptors.
6 From: Toby Gray <toby.gray@realvnc.com>
8 commit 577045c0a76e34294f902a7d5d60e90b04d094d0 upstream.
10 Certain USB devices, such as the Nokia X6 mobile phone, don't expose any
11 endpoint descriptors on some of their interfaces. If the ACM driver is forced
12 to probe all interfaces on a device the a NULL pointer dereference will occur
13 when the ACM driver attempts to use the endpoint of the alternative settings.
14 One way to get the ACM driver to probe all the interfaces is by using the
15 /sys/bus/usb/drivers/cdc_acm/new_id interface.
17 This patch checks that the endpoint pointer for the current alternate settings
18 is non-NULL before using it.
20 Signed-off-by: Toby Gray <toby.gray@realvnc.com>
21 Cc: Oliver Neukum <oliver@neukum.name>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25 drivers/usb/class/cdc-acm.c | 3 ++-
26 1 file changed, 2 insertions(+), 1 deletion(-)
28 --- a/drivers/usb/class/cdc-acm.c
29 +++ b/drivers/usb/class/cdc-acm.c
30 @@ -971,7 +971,8 @@ static int acm_probe(struct usb_interfac
34 - if (intf->cur_altsetting->endpoint->extralen &&
35 + if (intf->cur_altsetting->endpoint &&
36 + intf->cur_altsetting->endpoint->extralen &&
37 intf->cur_altsetting->endpoint->extra) {
39 "Seeking extra descriptors on endpoint\n");