Closed emaxx-google closed 1 year ago
The underlying problem, as uncovered by @ViktoriiaKovalova, is a race between the reader initialization and the shutdown logic. Shutdown tries to stop all ongoing USB transfers and then waits until all readers are deinitialized. However, if the init code didn't have a chance to set the USB transfer pointer before that, the cancellation is skipped, and the transfer becomes running until it reaches its 10-minute timeout.
I have a possible patch that works for me locally, but it's a bit of a band-aid fix as ideally the whole multi-threaded model should be redesigned. I'll publish it for the CCID maintainers for the review.
Pseudocode of a reproducer: