tty: Invert tty_lock/ldisc_sem lock order
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 5 Nov 2014 17:12:45 +0000 (12:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 02:24:10 +0000 (18:24 -0800)
commitc8483bc9deff9bf9118aaab2e840b973b75cac3e
tree4c6af9da2f1b01525014c8680f4d3c8955b54e12
parent3ee175d9d9f9be0e345f7237ee921e58f68afdd7
tty: Invert tty_lock/ldisc_sem lock order

Dropping the tty lock to acquire the tty->ldisc_sem allows several
race conditions (such as hangup while changing the ldisc) which requires
extra states and testing. The ldisc_sem->tty_lock lock order has
not been required since tty buffer ownership was moved to tty_port.

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>
drivers/tty/tty_ldisc.c