Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vgaarb: fix signal handling in vga_get()

There are few defects in vga_get() related to signal hadning:

- we shouldn't check for pending signals for TASK_UNINTERRUPTIBLE
case;

- if we found pending signal we must remove ourself from wait queue
and change task state back to running;

- -ERESTARTSYS is more appropriate, I guess.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: stable@vger.kernel.org
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Kirill A. Shutemov and committed by
Dave Airlie
9f5bd308 49307da3

+4 -2
+4 -2
drivers/gpu/vga/vgaarb.c
··· 395 395 set_current_state(interruptible ? 396 396 TASK_INTERRUPTIBLE : 397 397 TASK_UNINTERRUPTIBLE); 398 - if (signal_pending(current)) { 399 - rc = -EINTR; 398 + if (interruptible && signal_pending(current)) { 399 + __set_current_state(TASK_RUNNING); 400 + remove_wait_queue(&vga_wait_queue, &wait); 401 + rc = -ERESTARTSYS; 400 402 break; 401 403 } 402 404 schedule();