From: Alan Cox Date: Tue, 16 Jun 2009 16:00:40 +0000 (+0100) Subject: ldisc: Make sure the ldisc isn't active when we close it X-Git-Tag: firefly_0821_release~13899^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=52856ed732aeab5e8e0b7c9e2a7a3d31736218ab;p=firefly-linux-kernel-4.4.55.git ldisc: Make sure the ldisc isn't active when we close it Signed-off-by: Alan Cox Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 94b3e06d73ec..874c2486c034 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c @@ -793,6 +793,8 @@ void tty_ldisc_hangup(struct tty_struct *tty) /* Avoid racing set_ldisc */ mutex_lock(&tty->ldisc_mutex); /* Switch back to N_TTY */ + tty_ldisc_halt(tty); + tty_ldisc_wait_idle(tty); tty_ldisc_reinit(tty); /* At this point we have a closed ldisc and we want to reopen it. We could defer this to the next open but