mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-06 13:15:19 -05:00
fix(freertos-smp): Stream Buffer task lists must be manipulated in critical sections
Stream buffer task lists (xTaskWaitingToSend and xTaskWaitingToReceive) are updated without critical sections. These objects are shared objects and can be updated from an ISR context as well. Hence, these lists must always be updated in critical sections.
This commit is contained in:
parent
a1cc3bda48
commit
4ee717950d
1 changed files with 10 additions and 2 deletions
|
|
@ -947,7 +947,11 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
|
|||
|
||||
traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer );
|
||||
( void ) xTaskNotifyWaitIndexed( pxStreamBuffer->uxNotificationIndex, ( uint32_t ) 0, ( uint32_t ) 0, NULL, xTicksToWait );
|
||||
pxStreamBuffer->xTaskWaitingToSend = NULL;
|
||||
sbENTER_CRITICAL( pxStreamBuffer );
|
||||
{
|
||||
pxStreamBuffer->xTaskWaitingToSend = NULL;
|
||||
}
|
||||
sbEXIT_CRITICAL( pxStreamBuffer );
|
||||
} while( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE );
|
||||
}
|
||||
else
|
||||
|
|
@ -1171,7 +1175,11 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
|
|||
/* Wait for data to be available. */
|
||||
traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer );
|
||||
( void ) xTaskNotifyWaitIndexed( pxStreamBuffer->uxNotificationIndex, ( uint32_t ) 0, ( uint32_t ) 0, NULL, xTicksToWait );
|
||||
pxStreamBuffer->xTaskWaitingToReceive = NULL;
|
||||
sbENTER_CRITICAL( pxStreamBuffer );
|
||||
{
|
||||
pxStreamBuffer->xTaskWaitingToReceive = NULL;
|
||||
}
|
||||
sbEXIT_CRITICAL( pxStreamBuffer );
|
||||
|
||||
/* Recheck the data available after blocking. */
|
||||
xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue