Fix OpenSSH pty regression on close
OpenSSH expects the (non-blocking) read() of pty master to return EAGAIN only if it has received all of the slave-side output after it has received SIGCHLD. This used to work on pre-3.12 kernels. This fix effectively forces non-blocking read() and poll() to block for parallel i/o to complete for all ttys. It also unwinds these changes: 1)f8747d4a46
tty: Fix pty master read() after slave closes 2)52bce7f8d4
pty, n_tty: Simplify input processing on final close 3)1a48632ffe
pty: Fix input race when closing Inspired by analysis and patch from Marc Aurele La France <tsi@tuyoix.net> Reported-by: Volth <openssh@volth.com> Reported-by: Marc Aurele La France <tsi@tuyoix.net> BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=52 BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=2492 Signed-off-by: Brian Bloniarz <brian.bloniarz@gmail.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
d11df61853
commit
0f40fbbcc3
@@ -351,7 +351,6 @@ struct tty_file_private {
|
||||
#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
|
||||
#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
|
||||
#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
|
||||
#define TTY_OTHER_DONE 6 /* Closed pty has completed input processing */
|
||||
#define TTY_LDISC_OPEN 11 /* Line discipline is open */
|
||||
#define TTY_PTY_LOCK 16 /* pty private */
|
||||
#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
|
||||
@@ -480,6 +479,7 @@ extern void tty_buffer_init(struct tty_port *port);
|
||||
extern void tty_buffer_set_lock_subclass(struct tty_port *port);
|
||||
extern bool tty_buffer_restart_work(struct tty_port *port);
|
||||
extern bool tty_buffer_cancel_work(struct tty_port *port);
|
||||
extern void tty_buffer_flush_work(struct tty_port *port);
|
||||
extern speed_t tty_termios_baud_rate(struct ktermios *termios);
|
||||
extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
|
||||
extern void tty_termios_encode_baud_rate(struct ktermios *termios,
|
||||
|
Reference in New Issue
Block a user