tty: never hold BTM while getting tty_mutex
authorArnd Bergmann <arnd@arndb.de>
Tue, 1 Jun 2010 20:53:02 +0000 (22:53 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 20:47:43 +0000 (13:47 -0700)
commit64ba3dc3143d94bbe935722aa17fa516b232bc83
tree9649ffd431eb8dc97fbad83d47feaed96980cb7e
parentec79d6056de58511d8e46d9ae59d3878f958dc3e
tty: never hold BTM while getting tty_mutex

tty_mutex is never taken with the BTM held, except for
two corner cases that are worked around here.
We give up the BTM before calling tty_release() in the
error path of tty_open().
Similarly, we reorder the locking in ptmx_open()
to get tty_mutex before the BTM.

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/pty.c
drivers/char/tty_io.c