diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/vt_ioctl.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 1fa2da8f4fbe..c9f2dd620e87 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -1039,10 +1039,22 @@ int vt_waitactive(int vt) | |||
1039 | 1039 | ||
1040 | add_wait_queue(&vt_activate_queue, &wait); | 1040 | add_wait_queue(&vt_activate_queue, &wait); |
1041 | for (;;) { | 1041 | for (;;) { |
1042 | set_current_state(TASK_INTERRUPTIBLE); | ||
1043 | retval = 0; | 1042 | retval = 0; |
1044 | if (vt == fg_console) | 1043 | |
1044 | /* | ||
1045 | * Synchronize with redraw_screen(). By acquiring the console | ||
1046 | * semaphore we make sure that the console switch is completed | ||
1047 | * before we return. If we didn't wait for the semaphore, we | ||
1048 | * could return at a point where fg_console has already been | ||
1049 | * updated, but the console switch hasn't been completed. | ||
1050 | */ | ||
1051 | acquire_console_sem(); | ||
1052 | set_current_state(TASK_INTERRUPTIBLE); | ||
1053 | if (vt == fg_console) { | ||
1054 | release_console_sem(); | ||
1045 | break; | 1055 | break; |
1056 | } | ||
1057 | release_console_sem(); | ||
1046 | retval = -EINTR; | 1058 | retval = -EINTR; |
1047 | if (signal_pending(current)) | 1059 | if (signal_pending(current)) |
1048 | break; | 1060 | break; |