Re: OOPS after connection Droids MuIn USB display

From: Maxin John
Date: Fri May 06 2011 - 07:50:39 EST


Hi Eric,

> In the file drivers/usb/class/cdc-acm.c, around line 1098, there is a
> comment "/*workaround for switched interfaces */" and then a check:
>
> if (data_interface->cur_altsetting->desc.bInterfaceClass !=
> CDC_DATA_INTERFACE_TYPE)
>
> At this point, the variable data_interface is NULL and this causes the OOPS.
>

I have included some checks for "data_interface" since
"usb_ifnum_to_if" could return NULL.
Could you please check by applying this patch ?

Signed-off-by: Maxin B. John <maxin.john@xxxxxxxxx>
---
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e057e53..073f418 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -960,6 +960,10 @@ static int acm_probe(struct usb_interface *intf,
if (quirks == NO_UNION_NORMAL) {
data_interface = usb_ifnum_to_if(usb_dev, 1);
control_interface = usb_ifnum_to_if(usb_dev, 0);
+ if (!data_interface || !control_interface) {
+ dev_dbg(&intf->dev, "no interfaces\n");
+ return -ENODEV;
+ }
goto skip_normal_probe;
}

@@ -1031,6 +1035,10 @@ next_desc:
if (call_interface_num > 0) {
dev_dbg(&intf->dev, "No union descriptor,
using call management descriptor\n");
data_interface = usb_ifnum_to_if(usb_dev,
(data_interface_num = call_interface_num));
+ if (!data_interface) {
+ dev_dbg(&intf->dev, "no data interface\n");
+ return -ENODEV;
+ }
control_interface = intf;
} else {
if (intf->cur_altsetting->desc.bNumEndpoints != 3) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/