aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_ldisc.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-11-05 12:12:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 21:24:10 -0500
commit3ee175d9d9f9be0e345f7237ee921e58f68afdd7 (patch)
treee8434c32bdb6a6321e8e6a9b3890927f7e2e791f /drivers/tty/tty_ldisc.c
parent1bc8cde46a159c928f62ac48981cf230582e4b78 (diff)
tty: Don't hold tty_lock for ldisc release
The tty->ldisc_sem write lock is sufficient for serializing changes to tty->ldisc; holding the tty lock is not required. Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_ldisc.c')
-rw-r--r--drivers/tty/tty_ldisc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 2d822aa259b2..332a622b7203 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -764,6 +764,8 @@ static void tty_ldisc_kill(struct tty_struct *tty)
764 * Called during the final close of a tty/pty pair in order to shut down 764 * Called during the final close of a tty/pty pair in order to shut down
765 * the line discpline layer. On exit the ldisc assigned is N_TTY and the 765 * the line discpline layer. On exit the ldisc assigned is N_TTY and the
766 * ldisc has not been opened. 766 * ldisc has not been opened.
767 *
768 * Holding ldisc_sem write lock serializes tty->ldisc changes.
767 */ 769 */
768 770
769void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) 771void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
@@ -776,13 +778,9 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
776 tty_ldisc_debug(tty, "closing ldisc: %p\n", tty->ldisc); 778 tty_ldisc_debug(tty, "closing ldisc: %p\n", tty->ldisc);
777 779
778 tty_ldisc_lock_pair(tty, o_tty); 780 tty_ldisc_lock_pair(tty, o_tty);
779 tty_lock_pair(tty, o_tty);
780
781 tty_ldisc_kill(tty); 781 tty_ldisc_kill(tty);
782 if (o_tty) 782 if (o_tty)
783 tty_ldisc_kill(o_tty); 783 tty_ldisc_kill(o_tty);
784
785 tty_unlock_pair(tty, o_tty);
786 tty_ldisc_unlock_pair(tty, o_tty); 784 tty_ldisc_unlock_pair(tty, o_tty);
787 785
788 /* And the memory resources remaining (buffers, termios) will be 786 /* And the memory resources remaining (buffers, termios) will be