Re: [BUG] 2.6.31.2 io_ti

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 8 Oct 2009, Jean-Denis Girard wrote:

> Alan Stern a écrit :
> | Are you sure you are running the patched driver?
> |
> | Try this: Add a printk statement near the start of destroy_serial() in
> | drivers/usb/serial/usb-serial.c, just after the dbg() line.  Make it
> | print out the value of serial->num_ports.
> |
> | You can also add some printk statements to edge_release() in
> | io_edgeport.c.  Try to pin down exactly which statement causes the
> | invalid memory reference.
> |
> | Alan Stern
> |
> 
> I've upgraded to 2.6.31.3, rebuilt everything, problem persists. Below
> are the modifications I made, the printk in edge_release are not
> printed... I confirm that 2.6.31.1 is fine. I tried on my portable
> computer with unmodified kernel 2.6.32-rc3, it does also BUG, see below.

Now I feel stupid.  The edge_release() function for your device is in
io_ti.c, not io_edgeport.c.  But it doesn't matter, because the patch I
sent wasn't really right anyway.

Here's a new patch to try instead.  It supersedes the earlier patch.

Alan Stern



Index: usb-2.6/drivers/usb/serial/usb-serial.c
===================================================================
--- usb-2.6.orig/drivers/usb/serial/usb-serial.c
+++ usb-2.6/drivers/usb/serial/usb-serial.c
@@ -156,7 +156,8 @@ static void destroy_serial(struct kref *
 	if (serial->minor != SERIAL_TTY_NO_MINOR)
 		return_serial(serial);
 
-	serial->type->release(serial);
+	if (serial->attached && serial->type->release)
+		serial->type->release(serial);
 
 	/* Now that nothing is using the ports, they can be freed */
 	for (i = 0; i < serial->num_port_pointers; ++i) {
@@ -1059,12 +1060,15 @@ int usb_serial_probe(struct usb_interfac
 		module_put(type->driver.owner);
 		if (retval < 0)
 			goto probe_error;
+		serial->attached = 1;
 		if (retval > 0) {
 			/* quietly accept this device, but don't bind to a
 			   serial port as it's about to disappear */
 			serial->num_ports = 0;
 			goto exit;
 		}
+	} else {
+		serial->attached = 1;
 	}
 
 	if (get_free_serial(serial, num_ports, &minor) == NULL) {
Index: usb-2.6/include/linux/usb/serial.h
===================================================================
--- usb-2.6.orig/include/linux/usb/serial.h
+++ usb-2.6/include/linux/usb/serial.h
@@ -150,6 +150,7 @@ struct usb_serial {
 	struct usb_interface		*interface;
 	unsigned char			disconnected:1;
 	unsigned char			suspending:1;
+	unsigned char			attached:1;
 	unsigned char			minor;
 	unsigned char			num_ports;
 	unsigned char			num_port_pointers;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux