Skip to content

Commit

Permalink
HID: debug: fix error handling in hid_debug_events_read()
Browse files Browse the repository at this point in the history
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: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Apr 10, 2015
1 parent c627589 commit 8fec02a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hid/hid-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,

if (!list->hdev || !list->hdev->debug) {
ret = -EIO;
break;
set_current_state(TASK_RUNNING);
goto out;
}

/* allow O_NONBLOCK from other threads */
Expand Down

0 comments on commit 8fec02a

Please sign in to comment.