aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vt_ioctl.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-09-29 05:00:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:12 -0400
commitca9bda00b4aafc42cd3d1b9d32934463e2993b4c (patch)
treedbb7ba5320bb8d1cbf97b3493687cb87932ad5f4 /drivers/char/vt_ioctl.c
parentae78bf9c4f5fde3c67e2829505f195d7347ce3e4 (diff)
[PATCH] tty locking on resize
The current kernel serializes console resizes but does not serialize the resize against the tty structure updates. This means that while two parallel resizes cannot mess up the console you can get incorrect results reported. Secondly while doing this I added vc_lock_resize() to lock and resize the console. This leaves all knowledge of the console_sem in the vt/console driver and kicks it out of the tty layer, which is good Thirdly while doing this I decided I couldn't stand "disallocate" any longer so I switched it to "deallocate". Signed-off-by: Alan Cox <alan@redhat.com> Cc: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/vt_ioctl.c')
-rw-r--r--drivers/char/vt_ioctl.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index a5628a8b6620..a53e382cc107 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -96,7 +96,7 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str
96 if (!perm) 96 if (!perm)
97 return -EPERM; 97 return -EPERM;
98 if (!i && v == K_NOSUCHMAP) { 98 if (!i && v == K_NOSUCHMAP) {
99 /* disallocate map */ 99 /* deallocate map */
100 key_map = key_maps[s]; 100 key_map = key_maps[s];
101 if (s && key_map) { 101 if (s && key_map) {
102 key_maps[s] = NULL; 102 key_maps[s] = NULL;
@@ -819,20 +819,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
819 if (arg > MAX_NR_CONSOLES) 819 if (arg > MAX_NR_CONSOLES)
820 return -ENXIO; 820 return -ENXIO;
821 if (arg == 0) { 821 if (arg == 0) {
822 /* disallocate all unused consoles, but leave 0 */ 822 /* deallocate all unused consoles, but leave 0 */
823 acquire_console_sem(); 823 acquire_console_sem();
824 for (i=1; i<MAX_NR_CONSOLES; i++) 824 for (i=1; i<MAX_NR_CONSOLES; i++)
825 if (! VT_BUSY(i)) 825 if (! VT_BUSY(i))
826 vc_disallocate(i); 826 vc_deallocate(i);
827 release_console_sem(); 827 release_console_sem();
828 } else { 828 } else {
829 /* disallocate a single console, if possible */ 829 /* deallocate a single console, if possible */
830 arg--; 830 arg--;
831 if (VT_BUSY(arg)) 831 if (VT_BUSY(arg))
832 return -EBUSY; 832 return -EBUSY;
833 if (arg) { /* leave 0 */ 833 if (arg) { /* leave 0 */
834 acquire_console_sem(); 834 acquire_console_sem();
835 vc_disallocate(arg); 835 vc_deallocate(arg);
836 release_console_sem(); 836 release_console_sem();
837 } 837 }
838 } 838 }
@@ -847,11 +847,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
847 if (get_user(ll, &vtsizes->v_rows) || 847 if (get_user(ll, &vtsizes->v_rows) ||
848 get_user(cc, &vtsizes->v_cols)) 848 get_user(cc, &vtsizes->v_cols))
849 return -EFAULT; 849 return -EFAULT;
850 for (i = 0; i < MAX_NR_CONSOLES; i++) { 850 for (i = 0; i < MAX_NR_CONSOLES; i++)
851 acquire_console_sem(); 851 vc_lock_resize(vc_cons[i].d, cc, ll);
852 vc_resize(vc_cons[i].d, cc, ll);
853 release_console_sem();
854 }
855 return 0; 852 return 0;
856 } 853 }
857 854