[Pcsclite-muscle] Rare race condition in SCardGetStatusChange()
Maximilian Stein
maximilian.stein at secunet.com
Tue Apr 17 08:37:23 PDT 2018
On 17.04.2018 16:42, Ludovic Rousseau wrote:
>
> In CMD_WAIT_READER_STATE_CHANGE case you add:
> +#ifdef USE_USB
> + /* wait until all readers are ready */
> + RFWaitForReaderInit();
> +#endif
>
> Why?
Because I use CMD_WAIT_READER_STATE_CHANGE to dump the reader states to
the client (done inside EHRegisterClientForEvent()). So I mindlessly
copied this behaviour from CMD_GET_READERS_STATE, which was used
originally by SCardGetStatusChange().
But thinking about it, there is still a chance that a new reader is
discovered and not fully initialized exactly while dumping the reader
states. If this is not a problem, the call to RFWaitForReaderInit()
could be removed from both CMD_GET_READERS_STATE and
CMD_WAIT_READER_STATE_CHANGE. Otherwise updating and dumping the reader
states should maybe be synchronized by a mutex to avoid invalid state
information.
Regards,
Maximilian
More information about the pcsclite-muscle
mailing list