summaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-06-01 22:53:02 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 22:47:43 +0200
commit64ba3dc3143d94bbe935722aa17fa516b232bc83 (patch)
tree9649ffd431eb8dc97fbad83d47feaed96980cb7e /drivers/char/tty_io.c
parenttty: replace BKL with a new tty_lock (diff)
downloadlinux-64ba3dc3143d94bbe935722aa17fa516b232bc83.tar.xz
linux-64ba3dc3143d94bbe935722aa17fa516b232bc83.zip
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>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 5ee9081a560f..bb22cf495435 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1866,19 +1866,19 @@ got_driver:
printk(KERN_DEBUG "error %d in opening %s...", retval,
tty->name);
#endif
+ tty_unlock(); /* need to call tty_release without BTM */
tty_release(inode, filp);
- if (retval != -ERESTARTSYS) {
- tty_unlock();
+ if (retval != -ERESTARTSYS)
return retval;
- }
- if (signal_pending(current)) {
- tty_unlock();
+
+ if (signal_pending(current))
return retval;
- }
+
schedule();
/*
* Need to reset f_op in case a hangup happened.
*/
+ tty_lock();
if (filp->f_op == &hung_up_tty_fops)
filp->f_op = &tty_fops;
tty_unlock();