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>
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index abfd990..1b39dd6 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -287,7 +287,7 @@
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 @@
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;
}