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>
struct tty_struct *to = tty->link;
int c;
- if (!to || tty->stopped)
+ if (!to || !to->ldisc || tty->stopped)
return 0;
c = to->receive_room;
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 */
struct tty_struct *to = tty->link;
unsigned long flags;
- if (!to)
+ if (!to || !to->ldisc)
return;
if (to->ldisc->ops->flush_buffer)