Hi Greg,

Patch for usb-serial 

Description of Patch
--------------------

This patch fixes a race condition in the serial_close
method in the usb-serial layer. There can be a scenario
where a usb-serial adapter device driver's 'open' 
method is called while a close on the same port of
the device is happening. This would lead to freeing 
of tty data structures even when the port is in use.

Signed-off-by: Chinmay M. Kale <[EMAIL PROTECTED]>

--- linux-2.6.11.10/drivers/usb/serial/usb-serial.c.orig
2005-06-15 15:56:48.000000000 +0530
+++ linux-2.6.11.10/drivers/usb/serial/usb-serial.c     2005-06-16
11:36:31.136320864 +0530
@@ -546,11 +546,14 @@ static void serial_close(struct tty_stru
                /* only call the device specific close if this
                 * port is being closed by the last owner */
                port->serial->type->close(port, filp);
-
-               if (port->tty) {
-                       if (port->tty->driver_data)
-                               port->tty->driver_data = NULL;
-                       port->tty = NULL;
+                       /* An open call might be pending while close is
in progress.
+                        * Must check port->open_count before freeing
tty */
+                       if (port->open_count == 0) {
+                               if (port->tty) {
+                                       if (port->tty->driver_data)
+                                               port->tty->driver_data =
NULL;
+                                       port->tty = NULL;
+                               }
                        }

                module_put(port->serial->type->owner);




PS: This is what I was referring to earlier; the error was not in sysfs
 but in usbcore.  It"s not clear whether this is related to the error 
 reported by roel -- probably not.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to