[Pcsclite-cvs-commit] r6668 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Sun Jul 28 09:28:32 UTC 2013


Author: rousseau
Date: 2013-06-25 12:23:21 +0000 (Tue, 25 Jun 2013)
New Revision: 6668

Modified:
   trunk/PCSC/src/readerfactory.c
Log:
RFAddReader(): correctly manage thread safe multi-slot readers

If the driver declares it is TAG_IFD_SLOT_THREAD_SAFE then pcscd can
access each slots simultanously.

In this case some data must be duplicated at RFAddReader() step since
they will be destroyed at the removeReader() step.

Thanks to Frank Morgner for the bug report
Closes Alioth bug [#314315] "double free corruption when unloading serial
driver with multiple slots"


Modified: trunk/PCSC/src/readerfactory.c
===================================================================
--- trunk/PCSC/src/readerfactory.c	2013-06-20 07:37:18 UTC (rev 6667)
+++ trunk/PCSC/src/readerfactory.c	2013-06-25 12:23:21 UTC (rev 6668)
@@ -456,6 +456,12 @@
 
 		if (rv == IFD_SUCCESS && dwGetSize == 1 && ucThread[0] == 1)
 		{
+			Log1(PCSC_LOG_INFO, "Driver is slot thread safe");
+
+			sReadersContexts[dwContextB]->library =
+				strdup(sReadersContexts[dwContext]->library);
+			sReadersContexts[dwContextB]->device =
+				strdup(sReadersContexts[dwContext]->device);
 			sReadersContexts[dwContextB]->mMutex =
 				malloc(sizeof(pthread_mutex_t));
 			(void)pthread_mutex_init(sReadersContexts[dwContextB]->mMutex,




More information about the Pcsclite-cvs-commit mailing list