Skip to content

Commit

Permalink
tty: Flush tty buffers after hardware shutdown
Browse files Browse the repository at this point in the history
The line discipline buffer and the tty buffers must be flushed again
after hardware shutdown; otherwise, a brief window exists between the
ldisc flush in tty_port_close_start() and the subsequent
tty_port_shutdown(), during which more data could be received into the
tty buffers. A racing open might then be able to receive data from the
previous session.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Nov 6, 2014
1 parent 413ba63 commit 3f40f5b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/tty/tty_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty)
{
unsigned long flags;

tty_ldisc_flush(tty);
tty->closing = 0;

spin_lock_irqsave(&port->lock, flags);
Expand Down

0 comments on commit 3f40f5b

Please sign in to comment.