aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-03-02 09:59:37 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:10:27 -0500
commit20f62579dccc84428554b914e24a312a6554f841 (patch)
treebd6b0f2724d75ba7fd17bb6422bfa05505018474 /drivers/tty/vt
parent4001d7b7fc271052ebff43f327c26dc64806bbdf (diff)
vt: push down tioclinux cases
Some of this ventures into selection which is still a complete lost cause. We are not making it any worse. It's completely busted anyway. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/selection.c12
-rw-r--r--drivers/tty/vt/vt.c12
-rw-r--r--drivers/tty/vt/vt_ioctl.c2
3 files changed, 18 insertions, 8 deletions
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 738e45a35131..2a5091670927 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -75,7 +75,7 @@ clear_selection(void) {
75 75
76/* 76/*
77 * User settable table: what characters are to be considered alphabetic? 77 * User settable table: what characters are to be considered alphabetic?
78 * 256 bits 78 * 256 bits. FIXME: Needs a locking model.
79 */ 79 */
80static u32 inwordLut[8]={ 80static u32 inwordLut[8]={
81 0x00000000, /* control chars */ 81 0x00000000, /* control chars */
@@ -307,7 +307,8 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
307 * queue of the tty associated with the current console. 307 * queue of the tty associated with the current console.
308 * Invoked by ioctl(). 308 * Invoked by ioctl().
309 * 309 *
310 * Locking: always called with BTM from vt_ioctl 310 * Locking: called without locks. Calls the ldisc wrongly with
311 * unsafe methods,
311 */ 312 */
312int paste_selection(struct tty_struct *tty) 313int paste_selection(struct tty_struct *tty)
313{ 314{
@@ -322,13 +323,12 @@ int paste_selection(struct tty_struct *tty)
322 poke_blanked_console(); 323 poke_blanked_console();
323 console_unlock(); 324 console_unlock();
324 325
326 /* FIXME: wtf is this supposed to achieve ? */
325 ld = tty_ldisc_ref(tty); 327 ld = tty_ldisc_ref(tty);
326 if (!ld) { 328 if (!ld)
327 tty_unlock();
328 ld = tty_ldisc_ref_wait(tty); 329 ld = tty_ldisc_ref_wait(tty);
329 tty_lock();
330 }
331 330
331 /* FIXME: this is completely unsafe */
332 add_wait_queue(&vc->paste_wait, &wait); 332 add_wait_queue(&vc->paste_wait, &wait);
333 while (sel_buffer && sel_buffer_lth > pasted) { 333 while (sel_buffer && sel_buffer_lth > pasted) {
334 set_current_state(TASK_INTERRUPTIBLE); 334 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ce2b82343620..ab7385e526af 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2637,11 +2637,15 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
2637 ret = __put_user(data, p); 2637 ret = __put_user(data, p);
2638 break; 2638 break;
2639 case TIOCL_GETMOUSEREPORTING: 2639 case TIOCL_GETMOUSEREPORTING:
2640 console_lock(); /* May be overkill */
2640 data = mouse_reporting(); 2641 data = mouse_reporting();
2642 console_unlock();
2641 ret = __put_user(data, p); 2643 ret = __put_user(data, p);
2642 break; 2644 break;
2643 case TIOCL_SETVESABLANK: 2645 case TIOCL_SETVESABLANK:
2646 console_lock();
2644 ret = set_vesa_blanking(p); 2647 ret = set_vesa_blanking(p);
2648 console_unlock();
2645 break; 2649 break;
2646 case TIOCL_GETKMSGREDIRECT: 2650 case TIOCL_GETKMSGREDIRECT:
2647 data = vt_get_kmsg_redirect(); 2651 data = vt_get_kmsg_redirect();
@@ -2658,13 +2662,21 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
2658 } 2662 }
2659 break; 2663 break;
2660 case TIOCL_GETFGCONSOLE: 2664 case TIOCL_GETFGCONSOLE:
2665 /* No locking needed as this is a transiently
2666 correct return anyway if the caller hasn't
2667 disabled switching */
2661 ret = fg_console; 2668 ret = fg_console;
2662 break; 2669 break;
2663 case TIOCL_SCROLLCONSOLE: 2670 case TIOCL_SCROLLCONSOLE:
2664 if (get_user(lines, (s32 __user *)(p+4))) { 2671 if (get_user(lines, (s32 __user *)(p+4))) {
2665 ret = -EFAULT; 2672 ret = -EFAULT;
2666 } else { 2673 } else {
2674 /* Need the console lock here. Note that lots
2675 of other calls need fixing before the lock
2676 is actually useful ! */
2677 console_lock();
2667 scrollfront(vc_cons[fg_console].d, lines); 2678 scrollfront(vc_cons[fg_console].d, lines);
2679 console_unlock();
2668 ret = 0; 2680 ret = 0;
2669 } 2681 }
2670 break; 2682 break;
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index e05094d76344..c6720be8d210 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -298,9 +298,7 @@ int vt_ioctl(struct tty_struct *tty,
298 298
299 switch (cmd) { 299 switch (cmd) {
300 case TIOCLINUX: 300 case TIOCLINUX:
301 tty_lock();
302 ret = tioclinux(tty, arg); 301 ret = tioclinux(tty, arg);
303 tty_unlock();
304 break; 302 break;
305 case KIOCSOUND: 303 case KIOCSOUND:
306 if (!perm) 304 if (!perm)