diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-01 20:53:02 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 20:47:43 (GMT) |
commit | 64ba3dc3143d94bbe935722aa17fa516b232bc83 (patch) | |
tree | 9649ffd431eb8dc97fbad83d47feaed96980cb7e /drivers/char/tty_io.c | |
parent | ec79d6056de58511d8e46d9ae59d3878f958dc3e (diff) | |
download | linux-64ba3dc3143d94bbe935722aa17fa516b232bc83.tar.xz |
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.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 5ee9081..bb22cf4 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(); |