mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: Marcin Wojtas <marcin.s.wojtas@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] net: mvpp2: free pending TX timestamp skbs when the port is stopped
Date: Tue,  3 Nov 2026 10:05:35 +0000	[thread overview]
Message-ID: <20261103100535.1310088-1-vulab@iscas.ac.cn> (raw)

mvpp2_tx_hw_tstamp() takes an extra reference on skbs that need a TX
timestamp and stores them in port->tx_hwtstamp_queue[]. The reference is
dropped by mvpp2_isr_handle_ptp_queue() when the hardware reports the
timestamp. Nothing drains the queues when the port is stopped, so skbs
still waiting for a timestamp keep their reference until their queue
slot is reused, and are leaked for good when the port is removed.

Free the queued skbs in mvpp2_stop(), after the interrupts have been
released.

Fixes: f5015a594c50 ("net: mvpp2: ptp: add support for transmit timestamping")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 317af54369cf..fc020b8c8830 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3419,6 +3419,22 @@ static void mvpp2_isr_handle_ptp(struct mvpp2_port *port)
 		mvpp2_isr_handle_ptp_queue(port, 1);
 }
 
+static void mvpp2_tx_hwtstamp_flush(struct mvpp2_port *port)
+{
+	struct mvpp2_hwtstamp_queue *queue;
+	int nq, i;
+
+	for (nq = 0; nq < ARRAY_SIZE(port->tx_hwtstamp_queue); nq++) {
+		queue = &port->tx_hwtstamp_queue[nq];
+		for (i = 0; i < ARRAY_SIZE(queue->skb); i++) {
+			if (!queue->skb[i])
+				continue;
+			dev_kfree_skb_any(queue->skb[i]);
+			queue->skb[i] = NULL;
+		}
+	}
+}
+
 static void mvpp2_isr_handle_link(struct mvpp2_port *port,
 				  struct phylink_pcs *pcs, bool link)
 {
@@ -4914,6 +4930,7 @@ static int mvpp2_stop(struct net_device *dev)
 		free_irq(port->port_irq, port);
 
 	mvpp2_irqs_deinit(port);
+	mvpp2_tx_hwtstamp_flush(port);
 	if (!port->has_tx_irqs) {
 		for (thread = 0; thread < port->priv->nthreads; thread++) {
 			port_pcpu = per_cpu_ptr(port->pcpu, thread);
-- 
2.34.1


             reply	other threads:[~2026-11-03 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:05 Wentao Liang [this message]
2026-11-03 10:10 ` netdev-bot+sinfo
2026-11-08 17:34   ` Simon Horman
2026-11-03 10:25 ` Krzysztof Kozlowski
2026-11-07 12:00 ` netdev-bot+sashiko
2026-11-08 17:28   ` Simon Horman
2026-11-10 18:23 ` patchwork-bot+netdevbpf

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=20261103100535.1310088-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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®