Check-in [54d3a148ef]
Overview
SHA1:54d3a148efd03ee6b0263c91297e2d30779ac0c9
Date: 2016-02-16 16:06:54
User: rkeene
Comment:Fixed an issue where the mutex released slightly too early
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-02-16
17:04
[6218cc54fc] Added workaround for Google's PCSC where we cannot determine the amount of space required to hold the reader list automatically (user: rkeene, tags: trunk)
16:06
[54d3a148ef] Fixed an issue where the mutex released slightly too early (user: rkeene, tags: trunk)
16:06
[9f8b1347d9] Better handling of loss of connection to the PCSC daemon or card resetting (user: rkeene, tags: trunk)
Changes

Modified cackey.c from [ef984b4aeb] to [3b58f20dd7].

  5205   5205   		CACKEY_DEBUG_PRINTF("No token is present in slotID = %lu", slotID);
  5206   5206   
  5207   5207   		cackey_mutex_unlock(cackey_biglock);
  5208   5208   
  5209   5209   		return(CKR_TOKEN_NOT_PRESENT);
  5210   5210   	}
  5211   5211   
  5212         -	mutex_retval = cackey_mutex_unlock(cackey_biglock);
  5213         -	if (mutex_retval != 0) {
  5214         -		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
  5215         -
  5216         -		return(CKR_GENERAL_ERROR);
  5217         -	}
  5218         -
  5219   5212   	/* Determine token label from certificates */
  5220   5213   	memset(pInfo->label, ' ', sizeof(pInfo->label));
  5221   5214   	use_default_label = 1;
  5222   5215   
  5223   5216   	if (cackey_slots[slotID].label == NULL) {
  5224   5217   		pcsc_identities = cackey_read_certs(&cackey_slots[slotID], NULL, &num_certs);
  5225   5218   		if (pcsc_identities != NULL) {
................................................................................
  5237   5230   			cackey_free_certs(pcsc_identities, num_certs, 1);
  5238   5231   		}
  5239   5232   	} else {
  5240   5233   		memcpy(pInfo->label, cackey_slots[slotID].label, sizeof(pInfo->label));
  5241   5234   
  5242   5235   		use_default_label = 0;
  5243   5236   	}
         5237  +
         5238  +	mutex_retval = cackey_mutex_unlock(cackey_biglock);
         5239  +	if (mutex_retval != 0) {
         5240  +		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
         5241  +
         5242  +		return(CKR_GENERAL_ERROR);
         5243  +	}
  5244   5244   
  5245   5245   	if (use_default_label) {
  5246   5246   		memcpy(pInfo->label, defaultLabel, sizeof(defaultLabel) - 1);
  5247   5247   	}
  5248   5248   
  5249   5249   	memset(pInfo->manufacturerID, ' ', sizeof(pInfo->manufacturerID));
  5250   5250   	memcpy(pInfo->manufacturerID, manufacturerID, sizeof(manufacturerID) - 1);