Commit cdff025c authored by Peter Hurley's avatar Peter Hurley Committed by Kleber Sacilotto de Souza

tty: Reset c_line from driver's init_termios

BugLink: http://bugs.launchpad.net/bugs/1709126

After the ldisc is released, but before the tty is destroyed, the termios
is saved (in tty_free_termios()); this termios is restored if a new
tty is created on next open(). However, the line discipline is always
reset, which is not obvious in the current method. Instead, reset
as part of the restore.

Restore the original line discipline, which may not have been N_TTY.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ece53405)
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Acked-by: default avatarMarcelo Cerri <marcelo.cerri@canonical.com>
Acked-by: default avatarBenjamin M Romer <benjamin.romer@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent abd08af3
......@@ -1387,9 +1387,10 @@ int tty_init_termios(struct tty_struct *tty)
else {
/* Check for lazy saved data */
tp = tty->driver->termios[idx];
if (tp != NULL)
if (tp != NULL) {
tty->termios = *tp;
else
tty->termios.c_line = tty->driver->init_termios.c_line;
} else
tty->termios = tty->driver->init_termios;
}
/* Compatibility until drivers always set this */
......
......@@ -745,9 +745,6 @@ static void tty_ldisc_kill(struct tty_struct *tty)
tty_ldisc_put(tty->ldisc);
/* Force an oops if we mess this up */
tty->ldisc = NULL;
/* Ensure the next open requests the N_TTY ldisc */
tty_set_termios_ldisc(tty, N_TTY);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment