summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Waechtler <pwaechtler@mac.com>2011-04-28 20:53:58 +0200
committerJiri Kosina <jkosina@suse.cz>2011-04-29 13:53:53 +0200
commit06268b2a384ece73618c1ad7649d19905ab79806 (patch)
treeda225fd98a899a22959d78ffd80a86d8009ed3dd
parentHID: add support for Sony Navigation Controller (diff)
downloadlinux-06268b2a384ece73618c1ad7649d19905ab79806.tar.xz
linux-06268b2a384ece73618c1ad7649d19905ab79806.zip
HID: hiddev: fix error path in hiddev_read when interrupted
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>
-rw-r--r--drivers/hid/usbhid/hiddev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index af0a7c1002af..891ff531cf34 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -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);