From: Paolo Abeni <pabeni@redhat.com>
To: hujy652@gmail.com
Cc: nbd@nbd.name, lorenzo@kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com,
sujuan.chen@mediatek.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net v3 2/2] net:ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
Date: Thu, 30 Jul 2026 11:00:30 +0200 [thread overview]
Message-ID: <20260730090030.201100-1-pabeni@redhat.com> (raw)
In-Reply-To: <20260724172040.1653-2-hujy652@gmail.com>
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?
> +
> if (dev->wlan.hw_rro) {
> for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
--
This is an AI-generated review.
prev parent reply other threads:[~2026-07-30 9:01 UTC|newest]
Thread overview: 3+ 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 [this message]
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=20260730090030.201100-1-pabeni@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hujy652@gmail.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=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