Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

+2 -1
+2 -1
drivers/hid/hid-debug.c
··· 1127 1127 1128 1128 if (!list->hdev || !list->hdev->debug) { 1129 1129 ret = -EIO; 1130 - break; 1130 + set_current_state(TASK_RUNNING); 1131 + goto out; 1131 1132 } 1132 1133 1133 1134 /* allow O_NONBLOCK from other threads */