Hi,
Please find the patch below as per previous discussion for Linux Kernel
version: linux-2.6.11.10. Hope there are no more issues.


--- 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);


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 inconsistent value of the port->open_count variable
and lead 
to freeing of tty data structures even when the port is in use.
 

        Developer's Certificate of Origin 1.0

        By making a contribution to this project, I certify that:

        (a) The contribution was created in whole or in part by me and I
            have the right to submit it under the open source license
            indicated in the file; or

        (b) The contribution is based upon previous work that, to the
best
            of my knowledge, is covered under an appropriate open source
            license and I have the right under that license to submit
that
            work with modifications, whether created in whole or in part
            by me, under the same open source license (unless I am
            permitted to submit under a different license), as indicated
            in the file; or

        (c) The contribution was provided directly to me by some other
            person who certified (a), (b) or (c) and I have not modified
            it.


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


-------------------------------------------------------
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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to