linux/drivers/tty
Peter Hurley f8747d4a46 tty: Fix pty master read() after slave closes
Commit f95499c303,
  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>
2013-09-30 19:05:56 -07:00
..
hvc Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2013-09-06 11:14:33 -07:00
ipwireless tty: ipwireless: Remove redundant NULL check before kfree 2013-03-15 13:58:32 -07:00
serial serial: pch_uart: remove unnecessary tty_port_tty_get 2013-09-17 10:05:47 -07:00
vt vt: make the default color configurable 2013-08-05 15:06:46 +08:00
amiserial.c TTY: amiserial, remove unnecessary platform_set_drvdata() 2013-08-27 16:24:33 -07:00
bfin_jtag_comm.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
cyclades.c TTY: add tty_port_tty_hangup helper 2013-03-18 16:24:29 -07:00
ehv_bytechan.c TTY: ehv_bytechan: add missing platform_driver_unregister() when module exit 2013-05-20 12:15:59 -07:00
goldfish.c goldfish: move to tty_port for flip buffers 2013-01-25 08:09:38 -08:00
isicom.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
Kconfig tty: metag_da: Add metag DA TTY driver 2013-02-06 11:10:17 -08:00
Makefile tty: Add timed, writer-prioritized rw semaphore 2013-05-20 12:30:32 -07:00
metag_da.c tty: metag_da: avoid getting tty kref in dashtty_timer() 2013-02-06 11:10:17 -08:00
moxa.c TTY: add tty_port_tty_hangup helper 2013-03-18 16:24:29 -07:00
moxa.h
mxser.c tty: mxser: Fix build warning introduced by dfc7b837c7 (Re: linux-next: build warning after merge of the tty.current tree) 2013-05-22 10:26:02 -07:00
mxser.h
n_gsm.c Drivers: tty: n_gsm.c: fixed 7 errors & 6 warnings that checkpatch complained 2013-07-24 15:21:13 -07:00
n_hdlc.c
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c tty: Fix pty master read() after slave closes 2013-09-30 19:05:56 -07:00
nozomi.c TTY: add tty_port_tty_hangup helper 2013-03-18 16:24:29 -07:00
pty.c tty: Fix lock order in tty_do_resize() 2013-07-24 15:12:53 -07:00
rocket_int.h
rocket.c TTY: rocket, fix more no-PCI warnings 2013-05-20 12:15:59 -07:00
rocket.h
synclink_gt.c TTY: synclink_gt: fix DTR being raised on hang up 2013-04-12 14:08:17 -07:00
synclink.c TTY: synclink: replace bitmasks add operation with OR operation. 2013-07-29 12:47:37 -07:00
synclinkmp.c TTY: snyclinkmp: calculating wrong addresses 2013-07-24 15:23:38 -07:00
sysrq.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2013-09-07 10:38:46 -07:00
tty_audit.c audit: do not needlessly take a lock in tty_audit_exit 2013-04-30 15:31:28 -04:00
tty_buffer.c tty: Remove private constant from global namespace 2013-07-23 16:47:10 -07:00
tty_io.c tty: disassociate_ctty() sends the extra SIGCONT 2013-09-17 21:53:32 -04:00
tty_ioctl.c tty: Fix SIGTTOU not sent with tcflush() 2013-09-25 17:52:17 -07:00
tty_ldisc.c tty: Convert termios_mutex to termios_rwsem 2013-07-23 16:43:01 -07:00
tty_ldsem.c tty: Add timed, writer-prioritized rw semaphore 2013-05-20 12:30:32 -07:00
tty_mutex.c
tty_port.c tty_port: Fix refcounting leak in tty_port_tty_hangup() 2013-07-26 16:34:00 -07:00