diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-29 07:50:49 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-29 07:50:49 +0200 |
commit | 896d81fefe5d1919537db2c2150ab6384e4a6610 (patch) | |
tree | c5e3877667d74c729d788ea0e7e0526cfa4996e7 /drivers/tty | |
parent | acbdad8dd1abd98b216d8c37ff9c6de4aa595534 (diff) |
Revert "tty: Fix ldisc crash on reopened tty"
This reverts commit 71472fa9c52b1da27663c275d416d8654b905f05. It caused
merge issues, and Dmitry found some review issues.
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Michael Neuling <mikey@neuling.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/tty_ldisc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 4ee7742dced3..68947f6de5ad 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -669,17 +669,16 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) tty_ldisc_put(tty->ldisc); } + /* switch the line discipline */ + tty->ldisc = ld; tty_set_termios_ldisc(tty, disc); - retval = tty_ldisc_open(tty, ld); + retval = tty_ldisc_open(tty, tty->ldisc); if (retval) { if (!WARN_ON(disc == N_TTY)) { - tty_ldisc_put(ld); - ld = NULL; + tty_ldisc_put(tty->ldisc); + tty->ldisc = NULL; } } - - /* switch the line discipline */ - smp_store_release(&tty->ldisc, ld); return retval; } |