Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL_ETH_Transmit_IT() and HAL_ETH_Transmit() do not set HAL_ETH_STATE_BUSY before modifying TX descriptors creating race-condition #71

Open
KarstenHohmeier opened this issue Sep 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working eth Ethernet-related issue or pull-request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system

Comments

@KarstenHohmeier
Copy link

HAL_ETH_Transmit_IT() and HAL_ETH_Transmit() both test gState but do not set it to HAL_ETH_STATE_BUSY before operating on the TX descriptors inside ETH_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

@ASEHSTM
Copy link
Contributor

ASEHSTM commented Sep 13, 2024

ST Internal Reference: 191088

@ASEHSTM ASEHSTM moved this from To do to Analyzed in stm32cube-mcu-hal-dashboard Sep 13, 2024
@ASEHSTM ASEHSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working eth Ethernet-related issue or pull-request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system
Projects
Development

No branches or pull requests

3 participants