[Pcsclite-cvs-commit] r6757 - trunk/Drivers/ccid/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Mon Sep 30 13:35:23 UTC 2013


Author: rousseau
Date: 2013-09-30 13:35:22 +0000 (Mon, 30 Sep 2013)
New Revision: 6757

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
Multislot support: do not crash on exit

The field multislot_extension should be set to NULL only _after_ the
multi-slot thread management is stopped. This entry is used by the
Multi_PollingProc thread.


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2013-09-24 15:57:07 UTC (rev 6756)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2013-09-30 13:35:22 UTC (rev 6757)
@@ -839,6 +839,9 @@
 
 			/* Deallocate the extension itself */
 			free(msExt);
+
+			/* Stop the slot */
+			usbDevice[reader_index].multislot_extension = NULL;
 		}
 
 		if (usbDevice[reader_index].ccid.gemalto_firmware_features)
@@ -1577,9 +1580,6 @@
 
 	DEBUG_PERIODIC2("Stop (%d)", reader_index);
 
-	/* Stop the slot */
-	usbDevice[reader_index].multislot_extension = NULL;
-
 	interrupt_byte = (usbDevice[reader_index].ccid.bCurrentSlotIndex / 4) + 1;
 	interrupt_mask = 0x02 << (2 * (usbDevice[reader_index].ccid.bCurrentSlotIndex % 4));
 
@@ -1588,6 +1588,7 @@
 	/* Broacast an interrupt to wake-up the slot's thread */
 	msExt->buffer[interrupt_byte] |= interrupt_mask;
 	pthread_cond_broadcast(&msExt->condition);
+
 	pthread_mutex_unlock(&msExt->mutex);
 } /* Multi_InterruptStop */
 




More information about the Pcsclite-cvs-commit mailing list