From: Simon Horman <horms@kernel.org>
To: Wayen Yan <win847@gmail.com>
Cc: netdev@vger.kernel.org, lorenzo@kernel.org, pabeni@redhat.com,
kuba@kernel.org, edumazet@google.com, andrew+netdev@lunn.ch,
angelogioacchino.delregno@collabora.com, matthias.bgg@gmail.com,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] net: airoha: Clean up RX queues in airoha_dev_stop
Date: Wed, 17 Jun 2026 13:22:07 +0100 [thread overview]
Message-ID: <20260617122207.GD827683@horms.kernel.org> (raw)
In-Reply-To: <178160746585.2156302.190868309474762875@gmail.com>
On Tue, Jun 16, 2026 at 06:50:48PM +0800, Wayen Yan wrote:
> When the last port is stopped, airoha_dev_stop() clears TX queues
> but neglects to clean up RX queues. This can lead to:
> - RX ring buffer descriptors remaining valid after device close
> - Potential DMA synchronization issues on device reopen
> - Risk of use-after-free if pages are freed while DMA is still active
>
> Add cleanup loop for RX queues to mirror the TX queue cleanup,
> ensuring symmetric resource management.
>
> Fixes: 20bf7d07c956 ("net: airoha: add QDMA support for Airoha EN7581 Ethernet")
> Signed-off-by: Wayen Yan <win847@gmail.com>
Hi Wayen Yan,
There is AI-generated review of this patch-set available on both
https://sashiko.dev and https://netdev-ai.bots.linux.dev/sashiko/
I asked AI to summarise these concerns, it came up with the
following. I would appreciate it if you could look over this feedback.
1. NAPI Synchronization:
While the TX path is managed by the netdev layer during stop, the RX path
relies on the NAPI subsystem. Since NAPI remains active during
`airoha_dev_stop()`, the new cleanup loop could race with the poller
(`airoha_qdma_rx_process`). It would be safer to call `napi_disable()`
before draining the queues to ensure exclusive access to the descriptors.
2. RX Queue Refill:
Unlike TX, the RX hardware requires descriptors to be pre-allocated and
posted by the driver to receive data. Because this patch empties the rings,
`airoha_dev_open()` needs a corresponding update to refill them (e.g.,
via `airoha_qdma_fill_rx_queue()`). Without this, the interface will
encounter an empty ring on restart, leading to an RX stall.
3. SKB Accumulation:
The cleanup should also account for the `q->skb` pointer used for
fragmented packets. If a partial packet is sitting in the queue when the
interface is stopped, freeing it and resetting the pointer to NULL will
prevent a memory leak and ensure the next session starts with a clean
state.
prev parent reply other threads:[~2026-06-17 12:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 10:50 [PATCH] net: airoha: Clean up RX queues in airoha_dev_stop Wayen Yan
2026-06-17 12:22 ` Simon Horman [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=20260617122207.GD827683@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=win847@gmail.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