Skip to content

Commit 8fec02a

Browse files
author
Jiri Kosina
committed
HID: debug: fix error handling in hid_debug_events_read()
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent c627589 commit 8fec02a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hid/hid-debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
11271127

11281128
if (!list->hdev || !list->hdev->debug) {
11291129
ret = -EIO;
1130-
break;
1130+
set_current_state(TASK_RUNNING);
1131+
goto out;
11311132
}
11321133

11331134
/* allow O_NONBLOCK from other threads */

0 commit comments

Comments
 (0)