From: Zhi-Jun You <hujy652@gmail.com>
To: pabeni@redhat.com
Cc: andrew+netdev@lunn.ch, angelogioacchino.delregno@collabora.com,
davem@davemloft.net, edumazet@google.com, hujy652@gmail.com,
kuba@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
lorenzo@kernel.org, matthias.bgg@gmail.com, nbd@nbd.name,
netdev@vger.kernel.org, sujuan.chen@mediatek.com
Subject: Re: [PATCH net v3 2/2] net:ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
Date: Thu, 6 Aug 2026 23:54:30 +0800 [thread overview]
Message-ID: <20260806155430.768-1-hujy652@gmail.com> (raw)
In-Reply-To: <20260730090030.201100-1-pabeni@redhat.com>
On Thu, Jul 30, 2026 at 11:00:30AM +0200, Paolo Abeni wrote:
> From: AI Reviewer <ai@example.com>
>
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> Full review at: https://sashiko.dev/
> ---
> --- Patch [2]: [PATCH net v3 2/2] net:ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 ---
> commit 30cd2d1bc8bf876e5d201d631684431920a3f165
> Author: Zhi-Jun You <hujy652@gmail.com>
>
> net:ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
>
> This commit fixes an issue on non-DBDC MT7986 where WDMA_RING_TX(0) is
> never set up because idx is 1, even though it is required for WED RX to
> function. It addresses this by explicitly calling mtk_wed_wdma_tx_ring_setup
> if the WED version is v2 and rx_ring[0] is unallocated.
>
> Link: https://lore.kernel.org/r/20260711112128.971-1-hujy652@gmail.com
> Link: https://lore.kernel.org/r/20260630144831.1109-1-hujy652@gmail.com
>
> > diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
> > --- a/drivers/net/ethernet/mediatek/mtk_wed.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
> [ ... ]
> > @@ -2334,6 +2334,13 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
> > if (!dev->rx_wdma[i].desc)
> > mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
>
> [Severity: High]
> This is a pre-existing issue, but does this code ignore the return value
> from mtk_wed_wdma_rx_ring_setup()?
>
> If mtk_wed_ring_alloc() fails due to memory pressure, it returns an error
> without configuring the hardware base registers. Because the error is
> ignored, when DMA is later enabled in mtk_wed_start(), could the hardware
> attempt to fetch from unmapped physical addresses and cause an IOMMU fault?
>
> >
> > + /*
> > + * non-DBDC MT7986 allocates only rx_ring[1] and tx_wdma[1] during setup
> > + * but tx_wdma[0] is also needed for WED to function.
> > + */
> > + if (mtk_wed_is_v2(dev->hw) && !dev->rx_ring[0].desc)
> > + mtk_wed_wdma_tx_ring_setup(dev, 0, MTK_WED_WDMA_RING_SIZE, !!dev->tx_wdma[0].desc);
>
> [Severity: High]
> Does this new call to mtk_wed_wdma_tx_ring_setup() also need to check its
> return value?
>
> Similar to the RX ring above, if mtk_wed_ring_alloc() fails to allocate
> memory, the hardware base registers won't be configured. Since the caller
> proceeds to enable hardware DMA regardless, might this lead to the WED
> processing descriptors from unmapped memory and causing memory corruption
> or a system crash?
>
I am not sure how to proceed with this.
Can Felix or Lorenzo comment this?
Best regards,
Zhi-Jun
> > +
> > if (dev->wlan.hw_rro) {
> > for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
> --
> This is an AI-generated review.
>
next prev parent reply other threads:[~2026-08-06 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 17:20 [PATCH net v3 1/2] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
2026-07-24 17:20 ` [PATCH net v3 2/2] net:ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Zhi-Jun You
2026-07-30 9:00 ` Paolo Abeni
2026-08-06 15:54 ` Zhi-Jun You [this message]
2026-08-06 15:23 ` [PATCH net v3 1/2] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
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=20260806155430.768-1-hujy652@gmail.com \
--to=hujy652@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sujuan.chen@mediatek.com \
/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