Skip to content

Commit

Permalink
HID: hiddev: fix error path in hiddev_read when interrupted
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Waechtler authored and Jiri Kosina committed Apr 29, 2011
1 parent 35dca5b commit 06268b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 06268b2

Please sign in to comment.