]> git.ipfire.org Git - thirdparty/u-boot.git/commit
net: tftp: don't call stop callback from UDP handler
authorAlexander Sverdlin <alexander.sverdlin@siemens.com>
Mon, 13 May 2024 06:26:35 +0000 (08:26 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 23 May 2025 17:33:18 +0000 (11:33 -0600)
commit44340456475da953a30c5cc4fbe8a9bc013c8c0f
treecaf8508b8540731fccfc4e61186f6ba72ebd58ca
parentda24eb55327978410f5559f44ce1434ae8d8932d
net: tftp: don't call stop callback from UDP handler

Contrary to doc/develop/driver-model/ethernet.rst contract, eth_ops
.free_pkt can be called after .stop, there are several error paths in TFTP,
for instance:

eth_halt() <= tftp_handler() <= net_process_received_packet() <= eth_rx()
...
am65_cpsw_free_pkt() <= eth_rx()

Which results in (deliberately "tftpboot"ing non-existing file):

TFTP error: 'File not found' (1)
Not retrying...
am65_cpsw_nuss_port ethernet@8000000port@1: RX dma free_pkt failed -22

Avoid the DMA error message (and follow the documentation) by deferring
eth_halt() until net_loop() calls net_start_again() and only do
eth_halt_state_only() instead.

Fixes: aafda38fb266 ("Add error codes/handling for TFTP-server")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
net/eth-uclass.c
net/tftp.c