aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-07-21 23:05:03 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2008-08-01 12:43:02 -0700
commitd10b263f8e62cda0c3daefa2ebe7e05169d5b7ec (patch)
tree962d7661bb779088a726684ad55b35448505408b
parentd114d08c5c122f1394692dbfabe9dd34fc249107 (diff)
USB: fix usb serial pm counter decrement for disconnected interfaces
commit 62ad296b6ca78bd123864c138814c0a597873693 upstream usb serial decrements the pm counter even if an interface has been disconnected. If it was a logical disconnect the interface may belong already to another driver. This patch introduces a check for disconnected interfaces. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/usb-serial.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 0cb0d77dc42..db1db4cfc62 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -283,7 +283,10 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
}
if (port->open_count == 0) {
- usb_autopm_put_interface(port->serial->interface);
+ mutex_lock(&port->serial->disc_mutex);
+ if (!port->serial->disconnected)
+ usb_autopm_put_interface(port->serial->interface);
+ mutex_unlock(&port->serial->disc_mutex);
module_put(port->serial->type->driver.owner);
}