summaryrefslogtreecommitdiff
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-11-05 20:13:01 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 05:50:42 +0300
commit2aff5e2bc62db43e05c814461a08aff0fc2b7fe5 (patch)
tree8c43d997c471b171f8929fee681c1650c0f06c57 /include/linux/tty.h
parent7ffb6da93c383a71b7f2d29d70cd420faa1ddeee (diff)
downloadlinux-2aff5e2bc62db43e05c814461a08aff0fc2b7fe5.tar.xz
tty: Change tty lock order to master->slave
When releasing the master pty, the slave pty also needs to be locked to prevent concurrent tty count changes for the slave pty and to ensure that only one parallel master and slave release observe the final close, and proceed to destruct the pty pair. Conversely, when releasing the slave pty, locking the master pty is not necessary (since the master's state can be inferred by the slave tty count). Introduce tty_lock_slave()/tty_unlock_slave() which acquires/releases the tty lock of the slave pty. Remove tty_lock_pair()/tty_unlock_pair(). Dropping the tty_lock is no longer required to re-establish a stable lock order. Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index af1a7f3e4e4a..a07b4b415db8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -638,11 +638,8 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
/* functions for preparation of BKL removal */
extern void __lockfunc tty_lock(struct tty_struct *tty);
extern void __lockfunc tty_unlock(struct tty_struct *tty);
-extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
- struct tty_struct *tty2);
-extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
- struct tty_struct *tty2);
-
+extern void __lockfunc tty_lock_slave(struct tty_struct *tty);
+extern void __lockfunc tty_unlock_slave(struct tty_struct *tty);
/*
* this shall be called only from where BTM is held (like close)
*