public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Harper <james.harper@bigpond.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] fix oops from cdc_acm in 2.6.0-test5
Date: Sat, 13 Sep 2003 19:56:05 +1000	[thread overview]
Message-ID: <3F62E9B5.10408@bigpond.com> (raw)

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

This patch to 2.6.0-test5 fixes some pointer arithmetic errors in the 
cdc_acm driver which were causing an oops in usb_driver_claim_interface.

works for me!

James


[-- Attachment #2: cdc-acm.patch --]
[-- Type: text/plain, Size: 2378 bytes --]

--- cdc-acm.c.bak	2003-09-12 22:54:42.000000000 +1000
+++ cdc-acm.c	2003-09-13 00:03:06.000000000 +1000
@@ -139,7 +139,8 @@
 
 struct acm {
 	struct usb_device *dev;				/* the corresponding usb device */
-	struct usb_interface *iface;			/* the interfaces - +0 control +1 data */
+	struct usb_interface *iface_control;		/* the control interface */
+	struct usb_interface *iface_data;		/* the data interface */
 	struct tty_struct *tty;				/* the corresponding tty */
 	struct urb *ctrlurb, *readurb, *writeurb;	/* urbs */
 	struct acm_line line;				/* line coding (bits, stop, parity) */
@@ -167,7 +168,7 @@
 {
 	int retval = usb_control_msg(acm->dev, usb_sndctrlpipe(acm->dev, 0),
 		request, USB_RT_ACM, value,
-		acm->iface[0].altsetting[0].desc.bInterfaceNumber,
+		acm->iface_control->altsetting[0].desc.bInterfaceNumber,
 		buf, len, HZ * 5);
 	dbg("acm_control_msg: rq: 0x%02x val: %#x len: %#x result: %d", request, value, len, retval);
 	return retval < 0 ? retval : 0;
@@ -559,7 +560,6 @@
 		dbg("probing config %d", cfacm->desc.bConfigurationValue);
 
 		for (j = 0; j < cfacm->desc.bNumInterfaces - 1; j++) {
-		    
 			if (usb_interface_claimed(cfacm->interface[j]) ||
 			    usb_interface_claimed(cfacm->interface[j + 1]))
 			continue;
@@ -617,7 +617,8 @@
 			ctrlsize = epctrl->wMaxPacketSize;
 			readsize = epread->wMaxPacketSize;
 			acm->writesize = epwrite->wMaxPacketSize;
-			acm->iface = cfacm->interface[j];
+			acm->iface_control = cfacm->interface[j];
+			acm->iface_data = cfacm->interface[j+1];
 			acm->minor = minor;
 			acm->dev = dev;
 
@@ -673,8 +674,8 @@
 			acm->line.databits = 8;
 			acm_set_line(acm, &acm->line);
 
-			usb_driver_claim_interface(&acm_driver, acm->iface + 0, acm);
-			usb_driver_claim_interface(&acm_driver, acm->iface + 1, acm);
+			usb_driver_claim_interface(&acm_driver, acm->iface_control, acm);
+			usb_driver_claim_interface(&acm_driver, acm->iface_data, acm);
 
 			tty_register_device(acm_tty_driver, minor, &intf->dev);
 
@@ -705,8 +706,8 @@
 
 	kfree(acm->ctrlurb->transfer_buffer);
 
-	usb_driver_release_interface(&acm_driver, acm->iface + 0);
-	usb_driver_release_interface(&acm_driver, acm->iface + 1);
+	usb_driver_release_interface(&acm_driver, acm->iface_control);
+	usb_driver_release_interface(&acm_driver, acm->iface_data);
 
 	if (!acm->used) {
 		tty_unregister_device(acm_tty_driver, acm->minor);

                 reply	other threads:[~2003-09-13  9:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F62E9B5.10408@bigpond.com \
    --to=james.harper@bigpond.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox