• Al Borchers's avatar
    [PATCH] USB: revised usbserial open/close unbalanced get/put · adddb9fd
    Al Borchers authored
    Here is a new version of the patch to usb-serial.c to fix
    the unbalanced kref and module get/put in serial_open and
    serial_close when there are errors.  This version works
    correctly when try_module_get fails and now "rmmod --wait"
    works correctly.
    
    
    * If the low level usb serial open fails, the kref and
      module use counts are decremented once in open.  Before,
      they were mistakenly decremented again in close.
    
    * If try_module_get fails, the module use count is not
      changed.  Before, the module use count was mistakenly
      decremented.  Now "rmmod --wait" works correctly.
    
    * The tty->driver_data pointer is never set to NULL once
      the port is open.  Before there was a small window when
      it was mistakenly set to NULL for an already open port.
    Signed-off-by: default avatarAl Borchers <alborchers@steinerpoint.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    adddb9fd
usb-serial.c 43.1 KB