aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}