public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
       [not found]   ` <BANLkTi=OQ=ahXW2n=ww4ZZ8vK4=mv6Kc7A@mail.gmail.com>
@ 2011-05-11 10:06     ` Erik Slagter
  2011-05-11 13:47       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Slagter @ 2011-05-11 10:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxin John, greg

[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]

From: Erik Slagter <erik@slagter.name>

The Droids MuIn LCD operates like a serial remote terminal.
Data received are displayed directly on the LCD. This patch
fixes the kernel null pointer oops when it is plugged in.

Add NO_DATA_INTERFACE quirk to tell the driver that "control"
and "data" interfaces are not separated for this device, which
prevents dereferencing a null pointer in the device probe code.

Signed-off-by: Erik Slagter <erik@slagter.name>
Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Tested-by: Erik Slagter <erik@slagter.name>
---
This patch applies to vanilla kernel 2.6.38.2, but I am quite
confident it will apply to any recent kernel. It was created by
Maxin John after I located the problem, slightly modified by me
and tested by me, so blame me if it breaks anything.

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e057e53..caa2535 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -946,7 +946,7 @@ static int acm_probe(struct usb_interface *intf,
 	u8 ac_management_function = 0;
 	u8 call_management_function = 0;
 	int call_interface_num = -1;
-	int data_interface_num;
+	int data_interface_num = -1;
 	unsigned long quirks;
 	int num_rx_buf;
 	int i;
@@ -1030,7 +1030,11 @@ next_desc:
 	if (!union_header) {
 		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));
+			/* quirks for Droids MuIn LCD */
+			if (quirks & NO_DATA_INTERFACE)
+				data_interface = usb_ifnum_to_if(usb_dev, 0);
+			else
+				data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num));
 			control_interface = intf;
 		} else {
 			if (intf->cur_altsetting->desc.bNumEndpoints != 3) {
@@ -1622,6 +1626,11 @@ static const struct usb_device_id acm_ids[] = {
 	.driver_info = NOT_A_MODEM,
 	},

+	/* Support for Droids MuIn LCD */
+	{ USB_DEVICE(0x04d8, 0x000b),
+	.driver_info = NO_DATA_INTERFACE,
+	},
+
 	/* control interfaces without any protocol set */
 	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
 		USB_CDC_PROTO_NONE) },
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index b4ea54d..683104a 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -137,3 +137,4 @@ struct acm {
 #define SINGLE_RX_URB			2
 #define NO_CAP_LINE			4
 #define NOT_A_MODEM			8
+#define NO_DATA_INTERFACE		16



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5110 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
  2011-05-11 10:06     ` [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected Erik Slagter
@ 2011-05-11 13:47       ` Greg KH
  2011-05-11 14:13         ` Maxin B John
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2011-05-11 13:47 UTC (permalink / raw)
  To: Erik Slagter; +Cc: linux-kernel, Maxin John

On Wed, May 11, 2011 at 12:06:55PM +0200, Erik Slagter wrote:
> From: Erik Slagter <erik@slagter.name>
> 
> The Droids MuIn LCD operates like a serial remote terminal.
> Data received are displayed directly on the LCD. This patch
> fixes the kernel null pointer oops when it is plugged in.
> 
> Add NO_DATA_INTERFACE quirk to tell the driver that "control"
> and "data" interfaces are not separated for this device, which
> prevents dereferencing a null pointer in the device probe code.
> 
> Signed-off-by: Erik Slagter <erik@slagter.name>
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
> Tested-by: Erik Slagter <erik@slagter.name>
> ---
> This patch applies to vanilla kernel 2.6.38.2, but I am quite
> confident it will apply to any recent kernel. It was created by
> Maxin John after I located the problem, slightly modified by me
> and tested by me, so blame me if it breaks anything.

If Maxin created it, it should have his "From:" on the top, right?

And did Maxin really sign-off-by: on the patch?  You can not add other
people's names to that without them really doing it, that's not allowed
at all.

Care to redo it?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
  2011-05-11 13:47       ` Greg KH
@ 2011-05-11 14:13         ` Maxin B John
  2011-05-11 14:56           ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Maxin B John @ 2011-05-11 14:13 UTC (permalink / raw)
  To: Greg KH; +Cc: Erik Slagter, linux-kernel

Hi Greg,

> If Maxin created it, it should have his "From:" on the top, right?

It was a combined effort. I think, Erik has done the core part of it.

> And did Maxin really sign-off-by: on the patch?  You can not add other
> people's names to that without them really doing it, that's not allowed
> at all.

Yes. I have added the "sign-off-by:" by myself. While we were developing and
testing the patch, we have agreed to share the fame/blame together.

> Care to redo it?
Should we really re-do it for the "sign-off-by" issue ? If it is
really required,
we are ready to redo it.

Best Regards,
Maxin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
  2011-05-11 14:13         ` Maxin B John
@ 2011-05-11 14:56           ` Greg KH
  2011-05-11 14:59             ` Erik Slagter
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2011-05-11 14:56 UTC (permalink / raw)
  To: Maxin B John; +Cc: Erik Slagter, linux-kernel

On Wed, May 11, 2011 at 03:13:37PM +0100, Maxin B John wrote:
> Hi Greg,
> 
> > If Maxin created it, it should have his "From:" on the top, right?
> 
> It was a combined effort. I think, Erik has done the core part of it.

Ok, and from an email I just got from Erik, that's fine.

> > And did Maxin really sign-off-by: on the patch?  You can not add other
> > people's names to that without them really doing it, that's not allowed
> > at all.
> 
> Yes. I have added the "sign-off-by:" by myself. While we were developing and
> testing the patch, we have agreed to share the fame/blame together.

Ok, I wasn't aware of this.

> > Care to redo it?
> Should we really re-do it for the "sign-off-by" issue ? If it is
> really required,
> we are ready to redo it.

No, that's fine, I was not aware that both of you agreed to this.  I'll
add it to my "to-apply" queue and you will get an automated email when
it is applied to the tree.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
  2011-05-11 14:56           ` Greg KH
@ 2011-05-11 14:59             ` Erik Slagter
  0 siblings, 0 replies; 5+ messages in thread
From: Erik Slagter @ 2011-05-11 14:59 UTC (permalink / raw)
  To: Greg KH; +Cc: Maxin B John, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

> No, that's fine, I was not aware that both of you agreed to this.  I'll
> add it to my "to-apply" queue and you will get an automated email when
> it is applied to the tree.

Great, thanks!


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5110 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-11 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110510074421.GA2755@maxin>
     [not found] ` <4DC97BD0.6040403@slagter.name>
     [not found]   ` <BANLkTi=OQ=ahXW2n=ww4ZZ8vK4=mv6Kc7A@mail.gmail.com>
2011-05-11 10:06     ` [PATCH 001/001]: USB: cdc_acm: Fix oops when Droids MuIn LCD is connected Erik Slagter
2011-05-11 13:47       ` Greg KH
2011-05-11 14:13         ` Maxin B John
2011-05-11 14:56           ` Greg KH
2011-05-11 14:59             ` Erik Slagter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox