summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-09-19 22:13:23 +0200
committerLive-CD User <linux@linux.site>2009-09-19 22:13:23 +0200
commitd2b391822a11302add9e46476f3da4e18e6de84c (patch)
tree26cd352e935d0cf3c65181d78f9af86b21b48e79
parentcdc_acm: Fix to use modern speed interfaces (diff)
downloadlinux-d2b391822a11302add9e46476f3da4e18e6de84c.tar.xz
linux-d2b391822a11302add9e46476f3da4e18e6de84c.zip
tty: USB hangup is racy
The USB layer uses tty_hangup to deal with unplugs of the physical hardware (analogous to loss of carrier) and then frees the resources. However the tty_hangup is asynchronous. As the hangup can sleep we can use tty_vhangup which is the non async version to avoid freeing resources too early. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/usb-serial.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 99188c92068b..21dd72a5a715 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1161,10 +1161,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
if (port) {
struct tty_struct *tty = tty_port_tty_get(&port->port);
if (tty) {
- /* The hangup will occur asynchronously but
- the object refcounts will sort out all the
- cleanup */
- tty_hangup(tty);
+ tty_vhangup(tty);
tty_kref_put(tty);
}
kill_traffic(port);