diff options
Diffstat (limited to 'drivers/tty/vt/vt_ioctl.c')
-rw-r--r-- | drivers/tty/vt/vt_ioctl.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 416de29b133a..6bc9af583d6d 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -484,16 +484,19 @@ int vt_ioctl(struct tty_struct *tty, | |||
484 | ret = -EINVAL; | 484 | ret = -EINVAL; |
485 | goto out; | 485 | goto out; |
486 | } | 486 | } |
487 | /* FIXME: this needs the console lock extending */ | 487 | console_lock(); |
488 | if (vc->vc_mode == (unsigned char) arg) | 488 | if (vc->vc_mode == (unsigned char) arg) { |
489 | console_unlock(); | ||
489 | break; | 490 | break; |
491 | } | ||
490 | vc->vc_mode = (unsigned char) arg; | 492 | vc->vc_mode = (unsigned char) arg; |
491 | if (console != fg_console) | 493 | if (console != fg_console) { |
494 | console_unlock(); | ||
492 | break; | 495 | break; |
496 | } | ||
493 | /* | 497 | /* |
494 | * explicitly blank/unblank the screen if switching modes | 498 | * explicitly blank/unblank the screen if switching modes |
495 | */ | 499 | */ |
496 | console_lock(); | ||
497 | if (arg == KD_TEXT) | 500 | if (arg == KD_TEXT) |
498 | do_unblank_screen(1); | 501 | do_unblank_screen(1); |
499 | else | 502 | else |
@@ -688,6 +691,7 @@ int vt_ioctl(struct tty_struct *tty, | |||
688 | ret = -ENXIO; | 691 | ret = -ENXIO; |
689 | else { | 692 | else { |
690 | arg--; | 693 | arg--; |
694 | arg = array_index_nospec(arg, MAX_NR_CONSOLES); | ||
691 | console_lock(); | 695 | console_lock(); |
692 | ret = vc_allocate(arg); | 696 | ret = vc_allocate(arg); |
693 | console_unlock(); | 697 | console_unlock(); |
@@ -712,9 +716,9 @@ int vt_ioctl(struct tty_struct *tty, | |||
712 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) | 716 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) |
713 | ret = -ENXIO; | 717 | ret = -ENXIO; |
714 | else { | 718 | else { |
715 | vsa.console = array_index_nospec(vsa.console, | ||
716 | MAX_NR_CONSOLES + 1); | ||
717 | vsa.console--; | 719 | vsa.console--; |
720 | vsa.console = array_index_nospec(vsa.console, | ||
721 | MAX_NR_CONSOLES); | ||
718 | console_lock(); | 722 | console_lock(); |
719 | ret = vc_allocate(vsa.console); | 723 | ret = vc_allocate(vsa.console); |
720 | if (ret == 0) { | 724 | if (ret == 0) { |
@@ -895,17 +899,17 @@ int vt_ioctl(struct tty_struct *tty, | |||
895 | if (vcp) { | 899 | if (vcp) { |
896 | int ret; | 900 | int ret; |
897 | int save_scan_lines = vcp->vc_scan_lines; | 901 | int save_scan_lines = vcp->vc_scan_lines; |
898 | int save_font_height = vcp->vc_font.height; | 902 | int save_cell_height = vcp->vc_cell_height; |
899 | 903 | ||
900 | if (v.v_vlin) | 904 | if (v.v_vlin) |
901 | vcp->vc_scan_lines = v.v_vlin; | 905 | vcp->vc_scan_lines = v.v_vlin; |
902 | if (v.v_clin) | 906 | if (v.v_clin) |
903 | vcp->vc_font.height = v.v_clin; | 907 | vcp->vc_cell_height = v.v_clin; |
904 | vcp->vc_resize_user = 1; | 908 | vcp->vc_resize_user = 1; |
905 | ret = vc_resize(vcp, v.v_cols, v.v_rows); | 909 | ret = vc_resize(vcp, v.v_cols, v.v_rows); |
906 | if (ret) { | 910 | if (ret) { |
907 | vcp->vc_scan_lines = save_scan_lines; | 911 | vcp->vc_scan_lines = save_scan_lines; |
908 | vcp->vc_font.height = save_font_height; | 912 | vcp->vc_cell_height = save_cell_height; |
909 | console_unlock(); | 913 | console_unlock(); |
910 | return ret; | 914 | return ret; |
911 | } | 915 | } |