forked from LudovicRousseau/PCSC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure cleanup on libusb hotplug shutdown
Fix the race condition that can result in the hotplug_libusb's rescan thread triggering use-after-free during the daemon shutdown. The commit makes the main thread wait (using a POSIX pipe) for the rescan thread's cleanup instead of relying on a non-deterministic "sleep 1 second" workaround. Also fix memory leaks that could happen during the rescan thread shutdown. This could happen if the AraKiriHotPlug was false when it was checked by the HPRescanUsbBus() function, but changed to true by the time the next iteration of the "while" loop in HPEstablishUSBNotifications() checked it. The commit moves the cleanup to the latter function, so that the cleanup always takes place.
- Loading branch information
1 parent
e50c01e
commit 07749bc
Showing
2 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters