fix: use inherited priority for event item value in vTaskPrioritySet

When a task holds a mutex and has an inherited priority, the event list
item value should reflect the effective priority (pxTCB->uxPriority)
rather than the requested new priority (uxNewPriority). Using uxNewPriority
can result in incorrect ordering in the event waiting list, leading to
deadlock when a task tries to acquire multiple mutexes.

Fixes #1364
This commit is contained in:
Harsha 2026-03-15 21:04:41 +05:30
parent f1043c49d5
commit a53e9337e9

View file

@ -2936,7 +2936,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
* being used for anything else. */ * being used for anything else. */
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) ) if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
{ {
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxNewPriority ) ); listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ) );
} }
else else
{ {