aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-06-15 16:27:29 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 11:24:00 -0700
commitcbcb6d66af4c6169ce1c2d01a3ab345f04b8359d (patch)
treed01d804ed6b35df3614f22c42baee719eb6dfeb7 /drivers/char
parentb231125af7811a2f68c455d3bda95ac170ee4fa6 (diff)
pty: Narrow the race on ldisc locking
The pty code has always been buggy on its ldisc handling. The recent changes made the window for the race much bigger. Pending fixing it properly which is not at all trivial, at least make the race small again so we don't disrupt other dev work. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pty.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 5acd29e6e04..3910ce112a9 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -104,7 +104,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf,
struct tty_struct *to = tty->link;
int c;
- if (!to || tty->stopped)
+ if (!to || !to->ldisc || tty->stopped)
return 0;
c = to->receive_room;
@@ -148,7 +148,7 @@ static int pty_chars_in_buffer(struct tty_struct *tty)
int count;
/* We should get the line discipline lock for "tty->link" */
- if (!to || !to->ldisc->ops->chars_in_buffer)
+ if (!to || !to->ldisc || !to->ldisc->ops->chars_in_buffer)
return 0;
/* The ldisc must report 0 if no characters available to be read */
@@ -183,7 +183,7 @@ static void pty_flush_buffer(struct tty_struct *tty)
struct tty_struct *to = tty->link;
unsigned long flags;
- if (!to)
+ if (!to || !to->ldisc)
return;
if (to->ldisc->ops->flush_buffer)