diff options
author | Alan Cox <alan@redhat.com> | 2009-01-15 08:30:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-15 15:48:35 -0500 |
commit | c0253eec2a8e1140dd9672a1efe095cdcf5811d0 (patch) | |
tree | c48dc5283ca4f01005295a97a28e532818aedce6 | |
parent | 5393f780277165f282a37ed82dd878159ec9dad5 (diff) |
tty: Fix race in the flush for some ldiscs
If you issue an ioctl to flush a tty as the line discipline is changing or
otherwise unplugged you can get a crash. The bug is very old but the rest
of the BKL lock dropping and some very "good" luck on Ingo's part caught
an example.
Use the correct ldisc_ref form so that we wait for the ldisc change to
complete and then flush
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/tty_ioctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index a408c8e487ec..6f4c7d0a53bf 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | |||
1057 | if (retval) | 1057 | if (retval) |
1058 | return retval; | 1058 | return retval; |
1059 | 1059 | ||
1060 | ld = tty_ldisc_ref(tty); | 1060 | ld = tty_ldisc_ref_wait(tty); |
1061 | switch (arg) { | 1061 | switch (arg) { |
1062 | case TCIFLUSH: | 1062 | case TCIFLUSH: |
1063 | if (ld && ld->ops->flush_buffer) | 1063 | if (ld && ld->ops->flush_buffer) |