summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/pty.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 6c7151edd715..b0e2c4847a5d 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -110,16 +110,19 @@ static void pty_unthrottle(struct tty_struct *tty)
110static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) 110static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
111{ 111{
112 struct tty_struct *to = tty->link; 112 struct tty_struct *to = tty->link;
113 unsigned long flags;
113 114
114 if (tty->stopped) 115 if (tty->stopped)
115 return 0; 116 return 0;
116 117
117 if (c > 0) { 118 if (c > 0) {
119 spin_lock_irqsave(&to->port->lock, flags);
118 /* Stuff the data into the input queue of the other end */ 120 /* Stuff the data into the input queue of the other end */
119 c = tty_insert_flip_string(to->port, buf, c); 121 c = tty_insert_flip_string(to->port, buf, c);
120 /* And shovel */ 122 /* And shovel */
121 if (c) 123 if (c)
122 tty_flip_buffer_push(to->port); 124 tty_flip_buffer_push(to->port);
125 spin_unlock_irqrestore(&to->port->lock, flags);
123 } 126 }
124 return c; 127 return c;
125} 128}