diff options
author | Kirill A. Shutemov <kirill@shutemov.name> | 2015-11-29 21:17:31 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-12-10 23:04:44 -0500 |
commit | 9f5bd30818c42c6c36a51f93b4df75a2ea2bd85e (patch) | |
tree | 99f265dbc7b9ee58dfa5c0a9e2161e2d787a794d | |
parent | 49307da31be5708bb0b9926efb35dd74d946ab0c (diff) |
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>
-rw-r--r-- | drivers/gpu/vga/vgaarb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 3166e4bc4eb6..9abcaa53bd25 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -395,8 +395,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) | |||
395 | set_current_state(interruptible ? | 395 | set_current_state(interruptible ? |
396 | TASK_INTERRUPTIBLE : | 396 | TASK_INTERRUPTIBLE : |
397 | TASK_UNINTERRUPTIBLE); | 397 | TASK_UNINTERRUPTIBLE); |
398 | if (signal_pending(current)) { | 398 | if (interruptible && signal_pending(current)) { |
399 | rc = -EINTR; | 399 | __set_current_state(TASK_RUNNING); |
400 | remove_wait_queue(&vga_wait_queue, &wait); | ||
401 | rc = -ERESTARTSYS; | ||
400 | break; | 402 | break; |
401 | } | 403 | } |
402 | schedule(); | 404 | schedule(); |