]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
vgaarb: fix signal handling in vga_get()
authorKirill A. Shutemov <kirill@shutemov.name>
Mon, 30 Nov 2015 02:17:31 +0000 (04:17 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 18 Jan 2016 22:27:27 +0000 (22:27 +0000)
commit 9f5bd30818c42c6c36a51f93b4df75a2ea2bd85e upstream.

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>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/gpu/vga/vgaarb.c

index 366641d0483fa5f570a8865ea11c355b58c3f55a..5b9eccd3e9ff9531cb73bea4cd3485a7fc2c167a 100644 (file)
@@ -393,8 +393,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)
                set_current_state(interruptible ?
                                  TASK_INTERRUPTIBLE :
                                  TASK_UNINTERRUPTIBLE);
-               if (signal_pending(current)) {
-                       rc = -EINTR;
+               if (interruptible && signal_pending(current)) {
+                       __set_current_state(TASK_RUNNING);
+                       remove_wait_queue(&vga_wait_queue, &wait);
+                       rc = -ERESTARTSYS;
                        break;
                }
                schedule();