From: Oliver Neukum Date: Wed, 25 Jun 2008 11:32:49 +0000 (+0200) Subject: USB: fix usb serial pm counter decrement for disconnected interfaces X-Git-Tag: v2.6.27-rc1~946^2~21 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62ad296b6ca78bd123864c138814c0a597873693;p=linux-2.6 USB: fix usb serial pm counter decrement for disconnected interfaces 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 Cc: Stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 3bcf334665..3537986319 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); }