diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-06-15 15:14:23 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-24 01:43:01 +0200 |
commit | 6a1c0680cf3ba94356ecd58833e1540c93472a57 (patch) | |
tree | d370b0888214bb59049181ac98c567d153263f48 /drivers/tty/pty.c | |
parent | n_tty: Remove read_cnt (diff) | |
download | linux-6a1c0680cf3ba94356ecd58833e1540c93472a57.tar.xz linux-6a1c0680cf3ba94356ecd58833e1540c93472a57.zip |
tty: Convert termios_mutex to termios_rwsem
termios is commonly accessed unsafely (especially by N_TTY)
because the existing mutex forces exclusive access.
Convert existing usage.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index abfd99089781..1b39dd639ee9 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -287,7 +287,7 @@ static int pty_resize(struct tty_struct *tty, struct winsize *ws) struct tty_struct *pty = tty->link; /* For a PTY we need to lock the tty side */ - mutex_lock(&tty->termios_mutex); + down_write(&tty->termios_rwsem); if (!memcmp(ws, &tty->winsize, sizeof(*ws))) goto done; @@ -314,7 +314,7 @@ static int pty_resize(struct tty_struct *tty, struct winsize *ws) tty->winsize = *ws; pty->winsize = *ws; /* Never used so will go away soon */ done: - mutex_unlock(&tty->termios_mutex); + up_write(&tty->termios_rwsem); return 0; } |