USB: fix usb serial pm counter decrement for disconnected interfaces
authorOliver Neukum <oliver@neukum.org>
Wed, 25 Jun 2008 11:32:49 +0000 (13:32 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jul 2008 22:16:36 +0000 (15:16 -0700)
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>
Cc: Stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/usb-serial.c

index 3bcf334..3537986 100644 (file)
@@ -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);
        }