ldisc: Make sure the ldisc isn't active when we close it
authorAlan Cox <alan@linux.intel.com>
Tue, 16 Jun 2009 16:00:40 +0000 (17:00 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 16 Jun 2009 19:01:15 +0000 (12:01 -0700)
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tty_ldisc.c

index 94b3e06d73ec255316db59749e417ae2bee90ffe..874c2486c0343ccc617072eb77059d51a8a58a6d 100644 (file)
@@ -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