aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-06-15 09:14:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-23 19:43:01 -0400
commit6a1c0680cf3ba94356ecd58833e1540c93472a57 (patch)
treed370b0888214bb59049181ac98c567d153263f48 /include/linux/tty.h
parenta2f73be8ee36e48f11f89ab705beb3c587a2f320 (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 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8323ee4f95b9..d3042076d163 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -10,6 +10,7 @@
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/tty_flags.h> 11#include <linux/tty_flags.h>
12#include <uapi/linux/tty.h> 12#include <uapi/linux/tty.h>
13#include <linux/rwsem.h>
13 14
14 15
15 16
@@ -243,9 +244,9 @@ struct tty_struct {
243 244
244 struct mutex atomic_write_lock; 245 struct mutex atomic_write_lock;
245 struct mutex legacy_mutex; 246 struct mutex legacy_mutex;
246 struct mutex termios_mutex; 247 struct rw_semaphore termios_rwsem;
247 spinlock_t ctrl_lock; 248 spinlock_t ctrl_lock;
248 /* Termios values are protected by the termios mutex */ 249 /* Termios values are protected by the termios rwsem */
249 struct ktermios termios, termios_locked; 250 struct ktermios termios, termios_locked;
250 struct termiox *termiox; /* May be NULL for unsupported */ 251 struct termiox *termiox; /* May be NULL for unsupported */
251 char name[64]; 252 char name[64];
@@ -253,7 +254,7 @@ struct tty_struct {
253 struct pid *session; 254 struct pid *session;
254 unsigned long flags; 255 unsigned long flags;
255 int count; 256 int count;
256 struct winsize winsize; /* termios mutex */ 257 struct winsize winsize; /* termios rwsem */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 258 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 259 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 260 unsigned int receive_room; /* Bytes free for queue */