Commit 06268b2a authored by Peter Waechtler's avatar Peter Waechtler Committed by Jiri Kosina

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: default avatarPeter Waechtler <pwaechtler@mac.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 35dca5b4
...@@ -367,8 +367,10 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun ...@@ -367,8 +367,10 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
/* let O_NONBLOCK tasks run */ /* let O_NONBLOCK tasks run */
mutex_unlock(&list->thread_lock); mutex_unlock(&list->thread_lock);
schedule(); schedule();
if (mutex_lock_interruptible(&list->thread_lock)) if (mutex_lock_interruptible(&list->thread_lock)) {
finish_wait(&list->hiddev->wait, &wait);
return -EINTR; return -EINTR;
}
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
} }
finish_wait(&list->hiddev->wait, &wait); finish_wait(&list->hiddev->wait, &wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment