tty: reorder ldisc locking
authorArnd Bergmann <arnd@arndb.de>
Tue, 1 Jun 2010 20:53:06 +0000 (22:53 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 20:47:43 +0000 (13:47 -0700)
commit60af22d2ed490554cc92c8d0fed0b5b9cf687568
tree6c9d1b2d9b5c409dc6a38f26ed5b7ec0f37a041a
parentbe1bc2889a4db4961ef69f47fb471ecae9f23ade
tty: reorder ldisc locking

We need to release the BTM in paste_selection() when
sleeping in tty_ldisc_ref_wait to avoid deadlocks
with tty_ldisc_enable.

In tty_set_ldisc, we now always grab the BTM before
taking the ldisc_mutex in order to avoid AB-BA
deadlocks between the two.

tty_ldisc_halt potentially blocks on a workqueue
function that takes the BTM, so we must release
the BTM before calling it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/selection.c
drivers/char/tty_ldisc.c