summaryrefslogtreecommitdiff
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2015-01-17 20:42:06 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-02 18:11:27 (GMT)
commitd2b6f44779d3be22d32a5697bd30b59367fd2b33 (patch)
treed7d607053156ff19c610ed1e9c976156c3ac1050 /drivers/tty/pty.c
parent1d1d14da12e79a6c05fbe1a975401f0f56c93316 (diff)
downloadlinux-d2b6f44779d3be22d32a5697bd30b59367fd2b33.tar.xz
n_tty: Fix signal handling flushes
BRKINT and ISIG requires input and output flush when a signal char is received. However, the order of operations is significant since parallel i/o may be ongoing. Merge the signal handling for BRKINT with ISIG handling. Process the signal first. This ensures any ongoing i/o is aborted; without this, a waiting writer may continue writing after the flush occurs and after the signal char has been echoed. Write lock the termios_rwsem, which excludes parallel writers from pushing new i/o until after the output buffers are flushed; claiming the write lock is necessary anyway to exclude parallel readers while the read buffer is flushed. Subclass the termios_rwsem for ptys since the slave pty performing the flush may appear to reorder the termios_rwsem->tty buffer lock lock order; adding annotation clarifies that slave tty_buffer lock-> slave termios_rwsem -> master tty_buffer lock is a valid lock order. Flush the echo buffer. In this context, the echo buffer is 'output'. Otherwise, the output will appear discontinuous because the output buffer was cleared which contains older output than the echo buffer. Open-code the read buffer flush since the input worker does not need kicking (this is the input worker). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 0e27315..e72ee62 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -395,6 +395,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
goto err_put_module;
tty_set_lock_subclass(o_tty);
+ lockdep_set_subclass(&o_tty->termios_rwsem, TTY_LOCK_SLAVE);
if (legacy) {
/* We always use new tty termios data so we can do this