From: Peter Waechtler Date: Thu, 28 Apr 2011 18:53:58 +0000 (+0200) Subject: HID: hiddev: fix error path in hiddev_read when interrupted X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=06268b2a384ece73618c1ad7649d19905ab79806;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jiri Kosina --- 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);