Skip to content

Commit 0aa47a7

Browse files
rgundinashif
authored andcommitted
lib/cmsis_rtos_v1: Check for mutex owner in cmsis layer
Check for the mutex owner in the cmsis layer itself while releasing. Fixes #9574. Signed-off-by: Rajavardhan Gundi <[email protected]>
1 parent a7e5d2f commit 0aa47a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cmsis_rtos_v1/cmsis_mutex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ osStatus osMutexRelease(osMutexId mutex_id)
8484
return osErrorISR;
8585
}
8686

87-
/* The mutex was not obtained before */
88-
if (mutex->lock_count == 0) {
87+
/* Mutex was not obtained before or was not owned by current thread */
88+
if ((mutex->lock_count == 0) || (mutex->owner != _current)) {
8989
return osErrorResource;
9090
}
9191

0 commit comments

Comments
 (0)