Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157058
b: refs/heads/master
c: 5c58cef
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Aug 25, 2009
1 parent c6da1f5 commit 1da567b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7111dc73923e9737b38a3ef5b5f236109000ff28
refs/heads/master: 5c58ceff103d8a654f24769bb1baaf84a841b0cc
10 changes: 7 additions & 3 deletions trunk/drivers/char/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,9 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
* be obtained while the delayed work queue halt ensures that no more
* data is fed to the ldisc.
*
* In order to wait for any existing references to complete see
* tty_ldisc_wait_idle.
* You need to do a 'flush_scheduled_work()' (outside the ldisc_mutex)
* in order to make sure any currently executing ldisc work is also
* flushed.
*/

static int tty_ldisc_halt(struct tty_struct *tty)
Expand Down Expand Up @@ -753,11 +754,14 @@ void tty_ldisc_hangup(struct tty_struct *tty)
* N_TTY.
*/
if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
/* Make sure the old ldisc is quiescent */
tty_ldisc_halt(tty);
flush_scheduled_work();

/* Avoid racing set_ldisc or tty_ldisc_release */
mutex_lock(&tty->ldisc_mutex);
if (tty->ldisc) { /* Not yet closed */
/* Switch back to N_TTY */
tty_ldisc_halt(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
Expand Down

0 comments on commit 1da567b

Please sign in to comment.