HID: u2fzero: properly handle timeouts in usb_submit_urb
authorAndrej Shadura <andrew.shadura@collabora.co.uk>
Tue, 19 Oct 2021 15:29:17 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:56 +0000 (19:16 +0100)
commit6b4a3cfce497a277f7d91a4169112e7ea238b525
treef2b73cf748b93c26e6085c8849ccf30ce6676fdd
parent0fcb6023d14900785b391023d26b48f9a3133eeb
HID: u2fzero: properly handle timeouts in usb_submit_urb

[ Upstream commit 43775e62c4b784f44a159e13ba80e6146a42d502 ]

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: 42337b9d4d95 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-u2fzero.c