Skip to content

Commit 729f6ab

Browse files
committed
Fixed RTXv5 mutex owner list handling.
The prev-pointer of the running threads mutex list was not set when multiple mutexes are acquired at a time. This leads to a corrupted list if the mutexes are not freed in reversed order.
1 parent 3e11271 commit 729f6ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CMSIS/RTOS2/RTX/Source/rtx_mutex.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
187187
mutex->owner_thread = runnig_thread;
188188
mutex->owner_next = runnig_thread->mutex_list;
189189
mutex->owner_prev = NULL;
190+
if (runnig_thread->mutex_list != NULL) {
191+
runnig_thread->mutex_list->owner_prev = mutex;
192+
}
190193
runnig_thread->mutex_list = mutex;
191194
mutex->lock = 1U;
192195
EvrRtxMutexAcquired(mutex, mutex->lock);

0 commit comments

Comments
 (0)