HID: hiddev: fix error path in hiddev_read when interrupted
authorPeter Waechtler <pwaechtler@mac.com>
Thu, 28 Apr 2011 18:53:58 +0000 (20:53 +0200)
committerJiri Kosina <jkosina@suse.cz>
Fri, 29 Apr 2011 11:53:53 +0000 (13:53 +0200)
hiddev_read: in case mutex_lock_interruptible will be interrupted
remove the task from the wait queue.

Signed-off-by: Peter Waechtler <pwaechtler@mac.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hiddev.c

index af0a7c1002af7d97cf97379901341f561cbeff90..891ff531cf347726d87d909b475f2d15c98ff575 100644 (file)
@@ -367,8 +367,10 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
                                /* let O_NONBLOCK tasks run */
                                mutex_unlock(&list->thread_lock);
                                schedule();
-                               if (mutex_lock_interruptible(&list->thread_lock))
+                               if (mutex_lock_interruptible(&list->thread_lock)) {
+                                       finish_wait(&list->hiddev->wait, &wait);
                                        return -EINTR;
+                               }
                                set_current_state(TASK_INTERRUPTIBLE);
                        }
                        finish_wait(&list->hiddev->wait, &wait);