From: Kordian Chmielewski <kudzo51@gmail.com>
To: netdev@vger.kernel.org
Cc: f.fainelli@gmail.com, florian.fainelli@broadcom.com,
rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: bcm4908_enet: keep the RX buffer when the refill fails
Date: Thu, 3 Dec 2026 13:33:47 +0100 [thread overview]
Message-ID: <20261203123347.205398-1-kudzo51@gmail.com> (raw)
In-Reply-To: <179629488517.3146.16278518529618524423@kernel.org>
> [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
next prev parent reply other threads:[~2026-12-03 12:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:56 [PATCH net 0/2] net: bcm4908_enet: RX buffer fixes Kordian Chmielewski
2026-12-02 9:56 ` [PATCH net 1/2] net: bcm4908_enet: keep the RX buffer when the refill fails Kordian Chmielewski
2026-12-03 4:36 ` Florian Fainelli
2026-12-03 10:48 ` netdev-bot+sashiko
2026-12-03 12:33 ` Kordian Chmielewski [this message]
2026-12-02 9:56 ` [PATCH net 2/2] net: bcm4908_enet: keep the RX buffers when the RX channel does not stop Kordian Chmielewski
2026-12-03 4:38 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203123347.205398-1-kudzo51@gmail.com \
--to=kudzo51@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafal@milecki.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®