All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yangyu Chen" <cyy@cyyself.name>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/3] net: atlantic: free stranded TX buffers on ring deinit
Date: Sat, 25 Jul 2026 09:08:46 +0000	[thread overview]
Message-ID: <20260725090847.3590F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <tencent_E5DA048E95B86B31EB21258D8E7CE1825308@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incomplete fix: PTP TX ring still uses `aq_ring_tx_clean()` on teardown, leading to memory/DMA leaks and a locking violation.
--

--- Patch [1]: [PATCH net-next v2 1/3] net: atlantic: free stranded TX buffers on ring deinit ---
commit d506a87f11eebfd3878d7ddde798e451d9fd8627
Author: Yangyu Chen <cyy@cyyself.name>

net: atlantic: free stranded TX buffers on ring deinit

This commit brings back aq_ring_tx_deinit() to properly clean up TX rings 
on teardown by iterating up to sw_tail. It replaces the call to 
aq_ring_tx_clean() in aq_vec_deinit() to fix a memory and DMA mapping leak 
that occurs during interface shutdown.

Cc: stable@vger.kernel.org # v4.11+

> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
> index 2f9033ceed8ce..05814fea0f5f7 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
> @@ -275,7 +275,7 @@ void aq_vec_deinit(struct aq_vec_s *self)
>  
>  	for (i = 0U; self->tx_rings > i; ++i) {
>  		ring = self->ring[i];
> -		aq_ring_tx_clean(&ring[AQ_VEC_TX_ID]);
> +		aq_ring_tx_deinit(&ring[AQ_VEC_TX_ID]);
>  		aq_ring_rx_deinit(&ring[AQ_VEC_RX_ID]);
>  	}

[Severity: High]
This is a pre-existing issue, but should the PTP TX ring be updated to use 
aq_ring_tx_deinit() as well?

Looking at the PTP TX ring teardown path:

drivers/net/ethernet/aquantia/atlantic/aq_ptp.c:aq_ptp_ring_deinit() {
    ...
    aq_ring_tx_clean(&aq_ptp->ptp_tx);
    ...
}

Since aq_ring_tx_clean() only cleans up to hw_head, won't any PTP descriptors
between hw_head and sw_tail be leaked when the interface is stopped while
PTP TX packets are in flight? 

Also, since aq_ring_tx_clean() updates u64_stats without disabling preemption,
does keeping it here leave the teardown path vulnerable to a lockdep splat on
32-bit systems?

Does it make sense to update aq_ptp_ring_deinit() to use the newly restored
aq_ring_tx_deinit() for the PTP TX ring to fully close this leak?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_1F173E0FC1606D2AC704DC9C98AF10984607@qq.com?part=1

  parent reply	other threads:[~2026-07-25  9:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  9:00 [PATCH net-next v2 0/3] net: atlantic: convert RX path to page_pool Yangyu Chen
2026-07-24  9:01 ` [PATCH net-next v2 1/3] net: atlantic: free stranded TX buffers on ring deinit Yangyu Chen
2026-07-24 12:57   ` [EXTERNAL] " Sukhdeep Soni [C]
2026-07-25  9:08   ` sashiko-bot [this message]
2026-07-24  9:02 ` [PATCH net-next v2 2/3] net: atlantic: free RX pages of consumed but not refilled buffers Yangyu Chen
2026-07-24 13:01   ` [EXTERNAL] " Sukhdeep Soni [C]
2026-07-25  9:08   ` sashiko-bot
2026-07-24  9:02 ` [PATCH net-next v2 3/3] net: atlantic: convert RX path to page_pool Yangyu Chen
2026-07-24 13:37   ` [EXTERNAL] " Sukhdeep Soni [C]
2026-07-25  9:08   ` sashiko-bot

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=20260725090847.3590F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cyy@cyyself.name \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.