We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5484

Summary: [PATCH] hidapi/libusb/hid.c: fix race condition on device close.
Product: SDL Reporter: Ozkan Sezer <sezeroz>
Component: joystickAssignee: Ozkan Sezer <sezeroz>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: hidapi-libusb.patch

Description Ozkan Sezer 2021-01-19 12:53:24 UTC
Created attachment 4680 [details]
hidapi-libusb.patch

hidapi/libusb/hid.c: fix race condition on device close.

From hidapi mainstream git: https://github.com/libusb/hidapi/issues/142
https://github.com/libusb/hidapi/commit/d2c3a9862eefe2d3f4db0f00c0238277bfb4e44b

Read callback may fire itself on its own even after its been requested
to stop and exactly before the calling code waits for its completion in
indefinite loop.  Explicitly preventing re-fireing the submission loop
fixes the issue.


OK to apply?
Comment 1 Sam Lantinga 2021-01-19 16:44:35 UTC
Yes, go for it.
Comment 2 Ozkan Sezer 2021-01-19 16:51:24 UTC
Patch applied as https://hg.libsdl.org/SDL/rev/186ad1c1989e