[Pcsclite-git-commit] [PCSC] 01/16: Fix SCardGetStatusChange() when a reader is removed
Ludovic Rousseau
rousseau at moszumanska.debian.org
Thu May 11 16:26:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit cbe677fc8fe94663fa70c5179385b17bdb7debec
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Thu May 11 10:30:03 2017 +0200
Fix SCardGetStatusChange() when a reader is removed
Because of a race condition, a smart card reader removal may, in some
conditions, not be detected on the client side.
The problem is that when a reader is removed the clients are notified
(using EHSignalEventToClients() function) two times:
- the first time in EHStatusHandlerThread() from eventhandler.c just
before the event thread exists,
- the second time in removeReader() from readerfactory.c after the
reader has been removed
The problem is that the first time the clients are notified the reader
state has not yet changed. The reader is still visible by the clients.
If a client is slow to register to new events it may miss the second
notification and then wait "forever" in SCardGetStatusChange()
("forever" is defined as 60 seconds here as it is the event loop timeout).
The solution is to removed the first (in fact useless) notification.
Thanks to Maximilian Stein for the bug report and patch
"[Pcsclite-muscle] Race condition with SCardGetStatusChange() when USB
Reader is removed"
http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20170508/000855.html
---
src/eventhandler.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/eventhandler.c b/src/eventhandler.c
index 4def507..66158a2 100644
--- a/src/eventhandler.c
+++ b/src/eventhandler.c
@@ -502,7 +502,6 @@ static void EHStatusHandlerThread(READER_CONTEXT * rContext)
/*
* Exit and notify the caller
*/
- (void)EHSignalEventToClients();
Log1(PCSC_LOG_INFO, "Die");
rContext->hLockId = 0;
(void)pthread_exit(NULL);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list