• Peter Hurley's avatar
    tty: Change tty lock order to master->slave · 2aff5e2b
    Peter Hurley authored
    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: default avatarAlan Cox <alan@linux.intel.com>
    Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2aff5e2b
tty.h 24.1 KB