diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-01-09 21:13:44 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-01-26 23:17:54 -0800 |
commit | 0bfd464d3fdd5bb322f9cace4cc47f1796545cf7 (patch) | |
tree | 39464f856fd4dc6b58c31e2cfbbbb882ce3b7ec1 /drivers/tty/tty_mutex.c | |
parent | 92e963f50fc74041b5e9e744c330dca48e04f08d (diff) | |
download | linux-0bfd464d3fdd5bb322f9cace4cc47f1796545cf7.tar.bz2 |
tty: Wait interruptibly for tty lock on reopen
Allow a signal to interrupt the wait for a tty reopen; eg., if
the tty has starting final close and is waiting for the device to
drain.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Cc: stable <stable@vger.kernel.org> # 4.4
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_mutex.c')
-rw-r--r-- | drivers/tty/tty_mutex.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c index 77703a391207..d2f3c4cd697f 100644 --- a/drivers/tty/tty_mutex.c +++ b/drivers/tty/tty_mutex.c @@ -19,6 +19,14 @@ void __lockfunc tty_lock(struct tty_struct *tty) } EXPORT_SYMBOL(tty_lock); +int tty_lock_interruptible(struct tty_struct *tty) +{ + if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty)) + return -EIO; + tty_kref_get(tty); + return mutex_lock_interruptible(&tty->legacy_mutex); +} + void __lockfunc tty_unlock(struct tty_struct *tty) { if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty)) |