Commit 7b40fa98 authored by Jiri Kosina's avatar Jiri Kosina Committed by Jiri Slaby

HID: debug: fix error handling in hid_debug_events_read()

commit 8fec02a7 upstream.

In the unlikely case of hdev vanishing while hid_debug_events_read() was
sleeping, we can't really break out of the case switch as with other cases,
as on the way out we'll try to remove ourselves from the hdev waitqueue.

Fix this by taking a shortcut exit path and avoiding cleanup that doesn't
make sense in case hdev doesn't exist any more anyway.
Reported-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent ef18ea6b
...@@ -1027,7 +1027,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, ...@@ -1027,7 +1027,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
if (!list->hdev || !list->hdev->debug) { if (!list->hdev || !list->hdev->debug) {
ret = -EIO; ret = -EIO;
break; set_current_state(TASK_RUNNING);
goto out;
} }
/* allow O_NONBLOCK from other threads */ /* allow O_NONBLOCK from other threads */
......
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