提交 b0e14951 编写于 作者: J Jiri Kosina

HID: fix possible deadlock in hidraw_read

If the loop in hidraw_read() loops more than once, then we might
end up trying to acquire already locked mutex, casuing a deadlock.
Reported-by: Niceberg <iceberg@ispras.ru>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 ff9b00a2
......@@ -47,10 +47,9 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
char *report;
DECLARE_WAITQUEUE(wait, current);
while (ret == 0) {
mutex_lock(&list->read_mutex);
mutex_lock(&list->read_mutex);
while (ret == 0) {
if (list->head == list->tail) {
add_wait_queue(&list->hidraw->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册