Commit 08f30ff9 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

tty: USB hangup is racy

commit d2b39182 upstream.

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: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4260dc79
...@@ -1161,10 +1161,7 @@ void usb_serial_disconnect(struct usb_interface *interface) ...@@ -1161,10 +1161,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
if (port) { if (port) {
struct tty_struct *tty = tty_port_tty_get(&port->port); struct tty_struct *tty = tty_port_tty_get(&port->port);
if (tty) { if (tty) {
/* The hangup will occur asynchronously but tty_vhangup(tty);
the object refcounts will sort out all the
cleanup */
tty_hangup(tty);
tty_kref_put(tty); tty_kref_put(tty);
} }
kill_traffic(port); kill_traffic(port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment