Skip to content

Commit

Permalink
tty: USB hangup is racy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent 9b80fee commit d2b3918
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d2b3918

Please sign in to comment.