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

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Wed Dec 17 19:57:58 UTC 2014


Author: rousseau
Date: 2014-12-17 19:57:58 +0000 (Wed, 17 Dec 2014)
New Revision: 7054

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
Multi_InterruptRead(): failed to release a lock in some cases

"I found that the mutex is not locked in Multi_InterruptRead() if the
code go to again label."

Thanks to Godfrey Chung for the patch
http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20141215/000293.html


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2014-12-17 12:50:40 UTC (rev 7053)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2014-12-17 19:57:58 UTC (rev 7054)
@@ -1531,7 +1531,6 @@
 	interrupt_mask = 0x02 << (2 * (usbDevice[reader_index].ccid.bCurrentSlotIndex % 4));
 
 	/* Wait until the condition is signaled or a timeout occurs */
-	pthread_mutex_lock(&msExt->mutex);
 	gettimeofday(&local_time, NULL);
 	cond_wait_until.tv_sec = local_time.tv_sec;
 	cond_wait_until.tv_nsec = local_time.tv_usec * 1000;
@@ -1540,6 +1539,8 @@
 	cond_wait_until.tv_nsec += 1000000 * (timeout % 1000);
 
 again:
+	pthread_mutex_lock(&msExt->mutex);
+
 	rv = pthread_cond_timedwait(&msExt->condition, &msExt->mutex,
 		&cond_wait_until);
 




More information about the Pcsclite-cvs-commit mailing list