-
Notifications
You must be signed in to change notification settings - Fork 928
Closed
Description
Hi, developers, thank you for your checking. It seems the lock caam.ring.jr_lock is not released correctly when CAAM_ADR_SYNC(caam.ring.VirtualDesc, desc->idx * sizeof(unsigned int)) != 0 and other similar conditions in the function caamAddJob?
wolfssl/wolfcrypt/src/port/caam/caam_driver.c
Lines 541 to 591 in 5dff4dd
| CAAM_LOCK_MUTEX(&caam.ring.jr_lock); | |
| /* check input slot is available and then add */ | |
| if (CAAM_READ(0x1014) > 0) { | |
| int i; | |
| unsigned int *pt; | |
| pt = (unsigned int*)caam.ring.VirtualDesc; | |
| #if defined(WOLFSSL_CAAM_PRINT) | |
| printf("Doing Job :\n"); | |
| #endif | |
| for (i = 0; i < desc->idx; i = i + 1) { | |
| pt[i] = desc->desc[i]; | |
| #if defined(WOLFSSL_CAAM_PRINT) | |
| printf("\tCMD %02d [%p] = 0x%08X\n", i+1, pt + i, | |
| desc->desc[i]); | |
| #endif | |
| } | |
| pt = (unsigned int*)caam.ring.VirtualIn; | |
| pt[0] = (unsigned int)caam.ring.Desc; | |
| if (CAAM_ADR_SYNC(caam.ring.VirtualDesc, | |
| desc->idx * sizeof(unsigned int)) != 0) { | |
| return -1; | |
| } | |
| if (CAAM_ADR_SYNC(caam.ring.VirtualIn, | |
| CAAM_JOBRING_SIZE * sizeof(unsigned int)) != 0) { | |
| return -1; | |
| } | |
| #ifdef CAAM_DEBUG_MODE | |
| caamDebugDesc(desc); | |
| #else | |
| #if defined(WOLFSSL_CAAM_DEBUG) || defined(WOLFSSL_CAAM_PRINT) | |
| printf("started job 0x%08X done\n", (unsigned int)caam.ring.Desc); | |
| #endif | |
| CAAM_WRITE(CAAM_IRJAR0, 0x00000001); | |
| #endif | |
| } | |
| else { | |
| #if defined(WOLFSSL_CAAM_DEBUG) || defined(WOLFSSL_CAAM_PRINT) | |
| printf("SLOT = 0x%08X, IRJAR0 = 0x%08X\n", CAAM_READ(0x1014), | |
| CAAM_READ(CAAM_IRJAR0)); | |
| printf("Number of job in done queue = 0x%08X\n", CAAM_READ(0x103C)); | |
| #endif | |
| CAAM_UNLOCK_MUTEX(&caam.ring.jr_lock); | |
| return CAAM_WAITING; | |
| } | |
| CAAM_UNLOCK_MUTEX(&caam.ring.jr_lock); | |
| return Success; |
Best,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels