HAL_ETH_Transmit_IT() and HAL_ETH_Transmit() do not set HAL_ETH_STATE_BUSY before modifying TX descriptors creating race-condition #71
Labels
bug
Something isn't working
eth
Ethernet MAC (Media Access Controller)
hal
HAL-LL driver-related issue or pull-request.
internal bug tracker
Issue confirmed and logged into the internal bug tracking system
HAL_ETH_Transmit_IT()
andHAL_ETH_Transmit()
both test gState but do not set it to HAL_ETH_STATE_BUSY before operating on the TX descriptors insideETH_Prepare_Tx_Descriptors()
. This creates a race-condition among themselves and among each other when used concurrently from multiple threads (e.g. preemption under FreeRTOS).Also Test-and-Set of gState needs to be done atomically (see #70).
https://github.com/STMicroelectronics/stm32h7xx_hal_driver/blob/ceda3ceeca2ee77a76d2de2ee6b560ad87c90a48/Src/stm32h7xx_hal_eth.c#L1002-L1009
Expected was at minimum a Test-and-Set like this:
https://github.com/STMicroelectronics/stm32h7xx_hal_driver/blob/ceda3ceeca2ee77a76d2de2ee6b560ad87c90a48/Src/stm32h7xx_hal_eth.c#L719-L721
The text was updated successfully, but these errors were encountered: