Re: [PATCH net 1/2] net: bcm4908_enet: keep the RX buffer when the refill fails
From: Kordian Chmielewski
Date: Thu Dec 03 2026 - 07:36:00 EST
> [Severity: High]
> This drop path assumes every slot holds a valid mapped buffer. Can that
> assumption break when the refill fails at open time?
[ ... ]
> Should bcm4908_enet_open() check the return value of
> bcm4908_enet_dma_init() and unwind, calling free_irq() for both IRQs and
> returning the error?
Yes. open() ignoring that error is older than this patch, and it is the
first of the follow-ups listed in the cover letter.
When open() carries on after bcm4908_enet_dma_init() failed, the RX
ring is left in a broken state with or without this patch. The
descriptors before the failed slot still carry OWN and the bus
addresses of buffers that the error path has unmapped and freed.
bcm4908_enet_dma_ring_init() has not run, so the RX channel is enabled
with the descriptor base that bcm4908_enet_dma_reset() set to 0. And a
refill that works still passes the slot's NULL buffer to build_skb() or
skb_free_frag(), as the review describes.
The commit message is about a slot that a failed refill in poll_rx()
leaves empty, which this patch stops; here the slots are empty because
open() went on after the error.
What this patch changes in that state is a refill that fails: the
descriptor is now re-armed with the stale or zero address of the slot
and the loop moves on, where the old code stopped without writing the
descriptor.
> Can the device then write packet data into memory the driver no longer
> owns?
In that state the drop path can hand the DMA a freed or zero address,
as the error path already does for the descriptors before the failed
slot.
The fix is for open() to fail and unwind. I will send it next, together
with a fix for the napi_alloc_frag() point, which the cover letter lists
as well. If the maintainers would rather have the open() fix in this
series, before this patch, I will send a v2 with it.
Kordian