]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: fix usb serial pm counter decrement for disconnected interfaces
authorOliver Neukum <oliver@neukum.org>
Mon, 21 Jul 2008 23:05:03 +0000 (23:05 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Aug 2008 19:43:02 +0000 (12:43 -0700)
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>
drivers/usb/serial/usb-serial.c

index 0cb0d77dc429b2b5d0f0dbd916feac063db7a4f6..db1db4cfc62e4f94b5dc750b91798fc1953e2008 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);
        }