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 - [PATCH] hidapi/libusb/hid.c: fix race condition on device close.
Summary: [PATCH] hidapi/libusb/hid.c: fix race condition on device close.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Ozkan Sezer
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-19 12:53 UTC by Ozkan Sezer
Modified: 2021-01-19 16:51 UTC (History)
0 users

See Also:


Attachments
hidapi-libusb.patch (2.40 KB, patch)
2021-01-19 12:53 UTC, Ozkan Sezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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