diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-06-15 09:14:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-23 19:43:01 -0400 |
commit | 6a1c0680cf3ba94356ecd58833e1540c93472a57 (patch) | |
tree | d370b0888214bb59049181ac98c567d153263f48 /drivers/net/irda | |
parent | a2f73be8ee36e48f11f89ab705beb3c587a2f320 (diff) |
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/net/irda')
-rw-r--r-- | drivers/net/irda/irtty-sir.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index a41267197839..177441afeb96 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -123,14 +123,14 @@ static int irtty_change_speed(struct sir_dev *dev, unsigned speed) | |||
123 | 123 | ||
124 | tty = priv->tty; | 124 | tty = priv->tty; |
125 | 125 | ||
126 | mutex_lock(&tty->termios_mutex); | 126 | down_write(&tty->termios_rwsem); |
127 | old_termios = tty->termios; | 127 | old_termios = tty->termios; |
128 | cflag = tty->termios.c_cflag; | 128 | cflag = tty->termios.c_cflag; |
129 | tty_encode_baud_rate(tty, speed, speed); | 129 | tty_encode_baud_rate(tty, speed, speed); |
130 | if (tty->ops->set_termios) | 130 | if (tty->ops->set_termios) |
131 | tty->ops->set_termios(tty, &old_termios); | 131 | tty->ops->set_termios(tty, &old_termios); |
132 | priv->io.speed = speed; | 132 | priv->io.speed = speed; |
133 | mutex_unlock(&tty->termios_mutex); | 133 | up_write(&tty->termios_rwsem); |
134 | 134 | ||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
@@ -280,7 +280,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
280 | struct ktermios old_termios; | 280 | struct ktermios old_termios; |
281 | int cflag; | 281 | int cflag; |
282 | 282 | ||
283 | mutex_lock(&tty->termios_mutex); | 283 | down_write(&tty->termios_rwsem); |
284 | old_termios = tty->termios; | 284 | old_termios = tty->termios; |
285 | cflag = tty->termios.c_cflag; | 285 | cflag = tty->termios.c_cflag; |
286 | 286 | ||
@@ -292,7 +292,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
292 | tty->termios.c_cflag = cflag; | 292 | tty->termios.c_cflag = cflag; |
293 | if (tty->ops->set_termios) | 293 | if (tty->ops->set_termios) |
294 | tty->ops->set_termios(tty, &old_termios); | 294 | tty->ops->set_termios(tty, &old_termios); |
295 | mutex_unlock(&tty->termios_mutex); | 295 | up_write(&tty->termios_rwsem); |
296 | } | 296 | } |
297 | 297 | ||
298 | /*****************************************************************/ | 298 | /*****************************************************************/ |