Skip to content

Commit 43775e6

Browse files
andrewshaduraJiri Kosina
authored andcommitted
HID: u2fzero: properly handle timeouts in usb_submit_urb
The wait_for_completion_timeout function returns 0 if timed out or a positive value if completed. Hence, "less than zero" comparison always misses timeouts and doesn't kill the URB as it should, leading to re-sending it while it is active. Fixes: 42337b9 ("HID: add driver for U2F Zero built-in LED and RNG") Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent b7abf78 commit 43775e6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hid/hid-u2fzero.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int u2fzero_recv(struct u2fzero_device *dev,
132132

133133
ret = (wait_for_completion_timeout(
134134
&ctx.done, msecs_to_jiffies(USB_CTRL_SET_TIMEOUT)));
135-
if (ret < 0) {
135+
if (ret == 0) {
136136
usb_kill_urb(dev->urb);
137137
hid_err(hdev, "urb submission timed out");
138138
} else {

0 commit comments

Comments
 (0)