Skip to content
Commit 4690689a authored by Kevin ORourke's avatar Kevin ORourke Committed by Mahesh Mahadevan
Browse files

drivers: ethernet: eth_stm32_hal: fix bus error after disconnect



In some circumstances the struct eth_stm32_tx_context object that was
allocated on eth_tx's stack is still referenced after the function exits.
This usually happens when the network is disconnected, depending on the
PHY hardware.

When the network is reconnected there will eventually be a call to
HAL_ETH_ReleaseTxPacket, which calls HAL_ETH_TxFreeCallback with the
(now invalid) pointer to the tx context. When HAL_ETH_TxFreeCallback
tries to dereference that pointer we get a bus error.

Fix this by allocating struct eth_stm32_tx_context objects from a
static array, similarly to how the buffers are allocated. This ensures
that they remain valid until the HAL is finished with them.

Fixes: #79037

Signed-off-by: default avatarKevin ORourke <kevin.orourke@ferroamp.se>
parent 6bb0c092
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment