vt: fix potential race in VT_WAITACTIVE handler
commit93c27c733bcab7cc19cc77dc5fb8b605921adf59
authorMichal Januszewski <spock@gentoo.org>
Thu, 19 Apr 2007 20:34:50 +0000 (19 16:34 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 2 May 2007 00:06:00 +0000 (1 17:06 -0700)
treeb20b20d93b103dacd0aee45596b4915c49d4818d
parent21deacabe2e2b0b823dc9593f88af3fec103a974
vt: fix potential race in VT_WAITACTIVE handler

[PATCH] vt: fix potential race in VT_WAITACTIVE handler

On a multiprocessor machine the VT_WAITACTIVE ioctl call may return 0 if
fg_console has already been updated in redraw_screen() but the console
switch itself hasn't been completed.  Fix this by checking fg_console in
vt_waitactive() with the console sem held.

Signed-off-by: Michal Januszewski <spock@gentoo.org>
Acked-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/vt_ioctl.c