mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 13:01:57 -04:00
Event Groups: snapshot xEventGroupSetBits returning value while in vTaskSuspendAll (#1143)
Event Groups: snapshot xEventGroupSetBits returning value while in vTaskSuspendAll. Fixes uxEventBits dereference after event group deleted by higher priority thread.
This commit is contained in:
parent
d806240dfe
commit
d3052f1f50
|
@ -551,7 +551,7 @@
|
||||||
ListItem_t * pxNext;
|
ListItem_t * pxNext;
|
||||||
ListItem_t const * pxListEnd;
|
ListItem_t const * pxListEnd;
|
||||||
List_t const * pxList;
|
List_t const * pxList;
|
||||||
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
|
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits, uxReturnBits;
|
||||||
EventGroup_t * pxEventBits = xEventGroup;
|
EventGroup_t * pxEventBits = xEventGroup;
|
||||||
BaseType_t xMatchFound = pdFALSE;
|
BaseType_t xMatchFound = pdFALSE;
|
||||||
|
|
||||||
|
@ -635,12 +635,15 @@
|
||||||
/* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
|
/* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
|
||||||
* bit was set in the control word. */
|
* bit was set in the control word. */
|
||||||
pxEventBits->uxEventBits &= ~uxBitsToClear;
|
pxEventBits->uxEventBits &= ~uxBitsToClear;
|
||||||
|
|
||||||
|
/* Snapshot resulting bits. */
|
||||||
|
uxReturnBits = pxEventBits->uxEventBits;
|
||||||
}
|
}
|
||||||
( void ) xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
|
|
||||||
traceRETURN_xEventGroupSetBits( pxEventBits->uxEventBits );
|
traceRETURN_xEventGroupSetBits( uxReturnBits );
|
||||||
|
|
||||||
return pxEventBits->uxEventBits;
|
return uxReturnBits;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -483,14 +483,11 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
* and bit 0 set uxBitsToSet to 0x09.
|
* and bit 0 set uxBitsToSet to 0x09.
|
||||||
*
|
*
|
||||||
* @return The value of the event group at the time the call to
|
* @return The value of the event group at the time the call to
|
||||||
* xEventGroupSetBits() returns. There are two reasons why the returned value
|
* xEventGroupSetBits() returns. Returned value might have the bits specified
|
||||||
* might have the bits specified by the uxBitsToSet parameter cleared. First,
|
* by the uxBitsToSet parameter cleared if setting a bit results in a task
|
||||||
* if setting a bit results in a task that was waiting for the bit leaving the
|
* that was waiting for the bit leaving the blocked state then it is possible
|
||||||
* blocked state then it is possible the bit will be cleared automatically
|
* the bit will be cleared automatically (see the xClearBitOnExit parameter
|
||||||
* (see the xClearBitOnExit parameter of xEventGroupWaitBits()). Second, any
|
* of xEventGroupWaitBits()).
|
||||||
* unblocked (or otherwise Ready state) task that has a priority above that of
|
|
||||||
* the task that called xEventGroupSetBits() will execute and may change the
|
|
||||||
* event group value before the call to xEventGroupSetBits() returns.
|
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
|
Loading…
Reference in a new issue