aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-11-18 03:40:48 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-11-20 03:52:14 -0500
commit0c09b2ac35ff7c5f280e5cf8142ad0822f1c93b3 (patch)
tree91e207b9032e75988613f75fed949c43f60b3c21
parent71bb21b677e89a2b438b804231f92b779beda5d7 (diff)
Input: keyboard - fix theoretical race on vt switch
A VT switch can theoretically change fg_console between vc = vc_cons[fg_console].d and kbd = kbd_table + fg_console Fix it by replacing the second fg_console with vc->vc_num. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/char/keyboard.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 737be953cc58..747683f055ed 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -1136,7 +1136,7 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char u
1136static void kbd_rawcode(unsigned char data) 1136static void kbd_rawcode(unsigned char data)
1137{ 1137{
1138 struct vc_data *vc = vc_cons[fg_console].d; 1138 struct vc_data *vc = vc_cons[fg_console].d;
1139 kbd = kbd_table + fg_console; 1139 kbd = kbd_table + vc->vc_num;
1140 if (kbd->kbdmode == VC_RAW) 1140 if (kbd->kbdmode == VC_RAW)
1141 put_queue(vc, data); 1141 put_queue(vc, data);
1142} 1142}
@@ -1157,7 +1157,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1157 tty->driver_data = vc; 1157 tty->driver_data = vc;
1158 } 1158 }
1159 1159
1160 kbd = kbd_table + fg_console; 1160 kbd = kbd_table + vc->vc_num;
1161 1161
1162 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) 1162 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
1163 sysrq_alt = down ? keycode : 0; 1163 sysrq_alt = down ? keycode : 0;