aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt/selection.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-02-28 09:49:23 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 13:50:35 -0500
commit079c9534a96da9a85a2a2f9715851050fbfbf749 (patch)
tree0e3782ff6d341f38c6f0b3840cb3c8f2bc922df8 /drivers/tty/vt/selection.c
parent0fb8379dab9f97e4c56de8f9ea772c10eda27561 (diff)
vt:tackle kbd_table
Keyboard struct lifetime is easy, but the locking is not and is completely ignored by the existing code. Tackle this one head on - Make the kbd_table private so we can run down all direct users - Hoick the relevant ioctl handlers into the keyboard layer - Lock them with the keyboard lock so they don't change mid keypress - Add helpers for things like console stop/start so we isolate the poking around properly - Tweak the braille console so it still builds There are a couple of FIXME locking cases left for ioctls that are so hideous they should be addressed in a later patch. After this patch the kbd_table is private and all the keyboard jiggery pokery is in one place. This update fixes speakup and also a memory leak in the original. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt/selection.c')
-rw-r--r--drivers/tty/vt/selection.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 7a0a12ae5458..738e45a35131 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -30,6 +30,7 @@
30 30
31extern void poke_blanked_console(void); 31extern void poke_blanked_console(void);
32 32
33/* FIXME: all this needs locking */
33/* Variables for selection control. */ 34/* Variables for selection control. */
34/* Use a dynamic buffer, instead of static (Dec 1994) */ 35/* Use a dynamic buffer, instead of static (Dec 1994) */
35struct vc_data *sel_cons; /* must not be deallocated */ 36struct vc_data *sel_cons; /* must not be deallocated */
@@ -138,7 +139,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
138 char *bp, *obp; 139 char *bp, *obp;
139 int i, ps, pe, multiplier; 140 int i, ps, pe, multiplier;
140 u16 c; 141 u16 c;
141 struct kbd_struct *kbd = kbd_table + fg_console; 142 int mode;
142 143
143 poke_blanked_console(); 144 poke_blanked_console();
144 145
@@ -182,7 +183,11 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
182 clear_selection(); 183 clear_selection();
183 sel_cons = vc_cons[fg_console].d; 184 sel_cons = vc_cons[fg_console].d;
184 } 185 }
185 use_unicode = kbd && kbd->kbdmode == VC_UNICODE; 186 mode = vt_do_kdgkbmode(fg_console);
187 if (mode == K_UNICODE)
188 use_unicode = 1;
189 else
190 use_unicode = 0;
186 191
187 switch (sel_mode) 192 switch (sel_mode)
188 { 193 {