Re: [PATCH net 2/2] net: bcm4908_enet: keep the RX buffers when the RX channel does not stop
From: Florian Fainelli
Date: Wed Dec 02 2026 - 23:38:42 EST
On 12/2/2026 1:56 AM, Kordian Chmielewski wrote:
bcm4908_enet_stop() frees the RX buffers even when
bcm4908_enet_dma_rx_ring_disable() timed out, so the DMA may still
write a frame into a buffer that has been freed.
Do for RX what commit e2785f0ff0a2 ("net: bcm4908_enet: release the TX
ring on stop") did for TX: return the timeout and, when the channel did
not stop, leave the buffers to the DMA. They are leaked: the slots
forget them, so that nothing frees them later, not even the error path
of the next open().
The wait itself can also give up too early. Its 2 ms deadline is counted
in jiffies, which is a single tick at HZ=100 or HZ=250, so it can pass
after the first read of the channel config. With the change above, such
an early timeout would leak all the RX buffers. Wait with
read_poll_timeout() instead, and still clear ENABLE on every read that
finds it set, as the loop did.
Sashiko's reviews of the TX ring series pointed out both problems, the
second one in a TX copy of this loop in v2 of that series. I have not
seen the RX channel time out on the hardware.
bcm4908_enet_remove() still frees the descriptor ring, which the DMA may
also write to, after a stop() that timed out. This patch does not
change that.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Kordian Chmielewski <kudzo51@xxxxxxxxx>
Reviewed-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
--
Florian