path: root/drivers/tty/hvc/hvc_xen.c
diff options
authorPeter Hurley <peter@hurleysoftware.com>2013-09-27 13:27:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-30 19:05:56 -0700
commitf8747d4a466ab2cafe56112c51b3379f9fdb7a12 (patch)
tree5d3fbaa52d7967a924f790f1d0cb363a7ed0f498 /drivers/tty/hvc/hvc_xen.c
parent15c03dd4859ab16f9212238f29dd315654aa94f6 (diff)
tty: Fix pty master read() after slave closes
Commit f95499c3030fe1bfad57745f2db1959c5b43dca8, n_tty: Don't wait for buffer work in read() loop creates a race window which can cause a pty master read() to miss the last pty slave write(s) and return -EIO instead, thus signalling the pty slave is closed. This can happen when the pty slave is written and immediately closed but before the tty buffer i/o loop receives the new input; the pty master read() is scheduled, sees its read buffer is empty and the pty slave has been closed, and exits. Because tty_flush_to_ldisc() has significant performance impact for parallel i/o, rather than revert the commit, special case this condition (ie., when the read buffer is empty and the 'other' pty has been closed) and, only then, wait for buffer work to complete before re-testing if the read buffer is still empty. As before, subsequent pty master reads return any available data until no more data is available, and then returns -EIO to indicate the pty slave has closed. Reported-by: Mikael Pettersson <mikpelinux@gmail.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Tested-by: Mikael Pettersson <mikpelinux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc/hvc_xen.c')
0 files changed, 0 insertions, 0 deletions