diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-18 08:58:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:44 -0400 |
commit | 11dbf203922dc70a340417c895c95fb96f6b7068 (patch) | |
tree | 7c79b79c74a184a7d67d3f54af4e37dee930d11e /drivers/char/pty.c | |
parent | a0821df6e57c8af0053963d0d08c8d5198ea077d (diff) |
tty: avoid recursive BTM in pty_close
When the console has been redirected, a hangup of the tty
will cause tty_release to be called under the big tty_mutex,
which leads to a deadlock because hangup is also called
under the BTM.
This moves the BTM deeper into the tty_hangup function so
we can close the redirected tty without holding the BTM.
In case of pty, we now need to drop the BTM before
calling tty_vhangup.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Kacur <jkacur@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/pty.c')
-rw-r--r-- | drivers/char/pty.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index f2d7a76fab54..ad46eae1f9bb 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -62,7 +62,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
62 | if (tty->driver == ptm_driver) | 62 | if (tty->driver == ptm_driver) |
63 | devpts_pty_kill(tty->link); | 63 | devpts_pty_kill(tty->link); |
64 | #endif | 64 | #endif |
65 | tty_vhangup_locked(tty->link); | 65 | tty_unlock(); |
66 | tty_vhangup(tty->link); | ||
67 | tty_lock(); | ||
66 | } | 68 | } |
67 | } | 69 | } |
68 | 70 | ||