summaryrefslogtreecommitdiffstats
path: root/drivers/char/selection.c
diff options
context:
space:
mode:
authorAlan Cox2009-06-11 13:50:12 +0200
committerLinus Torvalds2009-06-11 17:51:01 +0200
commitc65c9bc3efa5589f691276bb9db689119a711222 (patch)
treeccb86ffb28ecafa77623fb2789faae8e4c1e2c4b /drivers/char/selection.c
parenttty: Extract various bits of ldisc code (diff)
downloadkernel-qcow2-linux-c65c9bc3efa5589f691276bb9db689119a711222.tar.gz
kernel-qcow2-linux-c65c9bc3efa5589f691276bb9db689119a711222.tar.xz
kernel-qcow2-linux-c65c9bc3efa5589f691276bb9db689119a711222.zip
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/selection.c')
-rw-r--r--drivers/char/selection.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/selection.c b/drivers/char/selection.c
index cb8ca5698963..f97b9e848064 100644
--- a/drivers/char/selection.c
+++ b/drivers/char/selection.c
@@ -327,7 +327,7 @@ int paste_selection(struct tty_struct *tty)
}
count = sel_buffer_lth - pasted;
count = min(count, tty->receive_room);
- tty->ldisc.ops->receive_buf(tty, sel_buffer + pasted,
+ tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
NULL, count);
pasted += count;
}