diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-11 12:50:12 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 08:51:01 -0700 |
commit | c65c9bc3efa5589f691276bb9db689119a711222 (patch) | |
tree | ccb86ffb28ecafa77623fb2789faae8e4c1e2c4b /drivers/char/n_hdlc.c | |
parent | e8b70e7d3e86319a8b2aaabde3866833d92cd80f (diff) | |
download | op-kernel-dev-c65c9bc3efa5589f691276bb9db689119a711222.zip op-kernel-dev-c65c9bc3efa5589f691276bb9db689119a711222.tar.gz |
tty: rewrite the ldisc locking
There are several pretty much unfixable races in the old ldisc code, especially
with respect to pty behaviour and also to hangup. It's easier to rewrite the
code than simply try and patch it up.
This patch
- splits the ldisc from the tty (so we will be able to refcount it more cleanly
later)
- introduces a mutex lock for ldisc changing on an active device
- fixes the complete mess that hangup caused
- implements hopefully correct setldisc/close/hangup locking
There are still some problems around pty pairs that have always been there but
at least it is now possible to understand the code and fix further problems.
This fixes the following known bugs
- hang up can leak ldisc references
- hang up may not call open/close on ldisc in a matched way
- pty/tty pairs can deadlock during an ldisc change
- reading the ldisc proc files can cause every ldisc to be loaded
and probably a few other of the mysterious ldisc race reports.
I'm sure it also adds the odd new one.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/n_hdlc.c')
-rw-r--r-- | drivers/char/n_hdlc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index bacb3e2..461ece5 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -342,8 +342,8 @@ static int n_hdlc_tty_open (struct tty_struct *tty) #endif /* Flush any pending characters in the driver and discipline. */ - if (tty->ldisc.ops->flush_buffer) - tty->ldisc.ops->flush_buffer(tty); + if (tty->ldisc->ops->flush_buffer) + tty->ldisc->ops->flush_buffer(tty); tty_driver_flush_buffer(tty); |