-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possible use-after-free of polling_transfer
Guard the multi-thread usage of polling_transfer with a mutex, to prevent the race condition between InterruptStop() and InterruptRead(): while the former is calling libusb_cancel_transfer(), the latter might've already called libusb_free_transfer() on the same pointer. This replaces the atomic variables that were previously used for the polling_transfer pointer, because atomic variables don't prevent this kind of use-after-free race condition. In practice, the probability of hitting the race condition was presumably low, but the basic scenario is the SCardConnect/SCardDisconnect calls overlapping with the time moments when the card is inserted/removed.
- Loading branch information
1 parent
2896a6a
commit 7f0847b
Showing
1 changed file
with
27 additions
and
19 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