On Thu, Sep 04, 2003 at 07:21:54PM +0100, Ian Abbott wrote:
> 
> I saw a report of a kernel oops on the ftdi-sio-devel list.  The 
> oops occurred when the [FTDI] USB serial device was unplugged while 
> doing 'cat /dev/ttyUSB0' and the oops was of the "Unabled to handle 
> kernel NULL pointer dereference" variety and the oops occurred in 
> the usb_serial_disconnect function.  To cut to the chase, the 
> offending lines in usb_serial_disconnect are as follows:
> 
>                               while (port->open_count > 0) {
>                                       __serial_close(port, NULL);
>                               }
>                               port->tty->driver_data = NULL;
> 
> If port->open_count > 0, the final call to __serial_close sets 
> port->tty = NULL, resulting in the null pointer dereference on the 
> final line above.

Ah, nice catch, thanks.
So does the following patch solve the problem for you?

thanks,

greg k-h


--- a/drivers/usb/serial/usbserial.c    Sat Aug 30 23:27:18 2003
+++ b/drivers/usb/serial/usbserial.c    Thu Sep  4 11:31:33 2003
@@ -1401,12 +1401,11 @@
                for (i = 0; i < serial->num_ports; ++i) {
                        port = &serial->port[i];
                        down (&port->sem);
-                       if (port->tty != NULL) {
-                               while (port->open_count > 0) {
+                       if (port->tty != NULL)
+                               while (port->open_count > 0)
                                        __serial_close(port, NULL);
-                               }
+                       if (port->tty != NULL)
                                port->tty->driver_data = NULL;
-                       }
                        up (&port->sem);
                }
 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to