Hi,

Here's a patch against 2.4.11-pre1 that fixes a number of reference
counting bugs in the usbserial driver core.  This patch has been in the
-ac tree for a while.

thanks,

greg k-h
(temporary USB maintainer)


diff --minimal -Nru a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c
--- a/drivers/usb/serial/usbserial.c    Mon Oct  1 10:48:29 2001
+++ b/drivers/usb/serial/usbserial.c    Mon Oct  1 10:48:29 2001
@@ -307,7 +307,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.3"
+#define DRIVER_VERSION "v1.4"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman, [EMAIL PROTECTED], 
http://www.kroah.com/linux-usb/";
 #define DRIVER_DESC "USB Serial Driver core"
 
@@ -343,6 +343,13 @@
        num_ports:              1,
        shutdown:               generic_shutdown,
 };
+
+#define if_generic_do(x)                                       \
+       if ((serial->dev->descriptor.idVendor == vendor) &&     \
+           (serial->dev->descriptor.idProduct == product))     \
+                       x
+#else
+#define if_generic_do(x)
 #endif
 
 
@@ -505,8 +512,6 @@
                return -ENODEV;
        }
 
-       MOD_INC_USE_COUNT;
-       
        /* set up our port structure making the tty driver remember our port object, 
and us it */
        portNumber = MINOR(tty->device) - serial->minor;
        port = &serial->port[portNumber];
@@ -544,8 +549,6 @@
        } else {
                generic_close(port, filp);
        }
-
-       MOD_DEC_USE_COUNT;
 }      
 
 
@@ -768,7 +771,8 @@
        if (port_paranoia_check (port, __FUNCTION__))
                return -ENODEV;
 
-       MOD_INC_USE_COUNT;
+       /* only increment our usage count, if this device is _really_ a generic device 
+*/
+       if_generic_do(MOD_INC_USE_COUNT);
 
        dbg(__FUNCTION__ " - port %d", port->number);
 
@@ -828,7 +832,9 @@
        }
 
        up (&port->sem);
-       MOD_DEC_USE_COUNT;
+
+       /* only decrement our usage count, if this device is _really_ a generic device 
+*/
+       if_generic_do(MOD_DEC_USE_COUNT);
 }
 
 


_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to