Skip to content

Commit 755a2f4

Browse files
torvaldsgregkh
authored andcommitted
vt_kdsetmode: extend console locking
commit 2287a51ba822384834dafc1c798453375d1107c7 upstream. As per the long-suffering comment. Reported-by: Minh Yuan <yuanmingbuaa@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 706938b commit 755a2f4

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/tty/vt/vt_ioctl.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,19 @@ int vt_ioctl(struct tty_struct *tty,
487487
ret = -EINVAL;
488488
goto out;
489489
}
490-
/* FIXME: this needs the console lock extending */
491-
if (vc->vc_mode == (unsigned char) arg)
490+
console_lock();
491+
if (vc->vc_mode == (unsigned char) arg) {
492+
console_unlock();
492493
break;
494+
}
493495
vc->vc_mode = (unsigned char) arg;
494-
if (console != fg_console)
496+
if (console != fg_console) {
497+
console_unlock();
495498
break;
499+
}
496500
/*
497501
* explicitly blank/unblank the screen if switching modes
498502
*/
499-
console_lock();
500503
if (arg == KD_TEXT)
501504
do_unblank_screen(1);
502505
else

0 commit comments

Comments
 (0)