net: mvpp2: free pending TX timestamp skbs when the port is stopped
Subsystems (4)
PATCH 1/1 net: mvpp2: free pending TX timestamp skbs when the port is stopped
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.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +17 -0
@@ -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);
Signature · 1 line
2.34.1
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Simon Horman
reviewerQuoted 17 lines · On Tue, Nov 03, 2026 at 10:10:28AM +0000, [email protected] wrote:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Quoted 8 lines
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Hi Wentao,
In my inbox, I count 39 emails of the form above from netdev-bot+sinfo to you in the past week or so. And zero responses from you. If I miscounted then I apologise. But in case it is not clear, a response to these messages is required.
I would appreciate it if you could provided responses to all such messages for patches which are still active on patchwork.
Quoted 10 lines · Wentao Liang
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 bymvpp2_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.
Quoted 8 lines
Fixes f5015a594c50 ("net: mvpp2: ptp: add support for transmit timestamping")Assisted-by DeepSeek-V4.1-Flash and OpenAI CodexSigned-off-by Wentao Liang <[email protected]>--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent subsystems. The amount of these patches clearly suggest this was AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing relevant patches into patchsets. This makes reviewing difficult and might cause multiple reviewers to address the same issue. Replying to the entire set is impossible and requires handling each patch independently, instead of applying or discarding the set. Maintainers also won't see the bigger picture of your work. Quite worrying.
This is on the verge of hostile patch: bomb us with so many contributions, we won't be able to handle them in efficient manner, like responding ONCE to ask you to slow down. Considering all this is untested and LLM generated, I have even more doubts whether this should be considered for review.
Please read kernel documentation BEFORE posting more work. It will explain you how to identify subsystems, how to organize your work per subsystem (so a patchset grouping multiple patches with a short cover letter), how to document the issue discovery method and what was or was not tested.
Best regards,
Krzysztof
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 (1) · Medium: 0 · Low: 0 (1)
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] The new mvpp2_tx_hwtstamp_flush() (drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:3422-3436) checks,…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a serious race on the same data.
- [Low] Baseline decision: not a valid finding against this patch.
--
net: mvpp2: free pending TX timestamp skbs when the port is stopped
This commit adds mvpp2_tx_hwtstamp_flush(). It frees any skbs still held in port->tx_hwtstamp_queue[] that are waiting for a hardware TX timestamp. It is called from mvpp2_stop() after the port interrupts have been released, so the extra references taken by mvpp2_tx_hw_tstamp() are not leaked.
Quoted 10 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2
-0@@ -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) +{
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static void mvpp2_isr_handle_ptp(struct mvpp2_port *port) · line 3433
Quoted 10 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +10
-0+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 ;
[Severity: High]
Can this race with mvpp2_tx_hw_tstamp() on another CPU and free the same skb twice?
mvpp2_stop() is not only reached through ndo_stop, where __dev_close_many() has already quiesced TX. It is also called directly on running devices:
mvpp2_xdp_setup():
if (running && reset) mvpp2_stop(port->dev);
mvpp2_change_mtu()->mvpp2_bm_switch_buffers():
for (i = 0; i < priv->port_count; i++) {
port = priv->port_list[i];
status[i] = netif_running(port->dev);
if (status[i])
mvpp2_stop(port->dev);
}The second path stops every running port on the controller, including ports whose MTU did not change.
mvpp2_stop_dev() does set_bit(0, &port->state), which mvpp2_tx() never checks. It also disables interrupts and NAPI and calls phylink_stop().
The only TX gating is netif_tx_stop_all_queues() in mvpp2_mac_link_down(). It does not wait for an mvpp2_tx() that is already running on another CPU. On ports without phylink, the TX queues are not stopped at all.
Meanwhile the xmit path works on the same array:
mvpp2_tx_hw_tstamp():
i = queue->next; queue->next = (i + 1) & 31; if (queue->skb[i]) dev_kfree_skb_any(queue->skb[i]); queue->skb[i] = skb_get(skb);
Suppose the flush and an in-flight xmit both see the same skb in skb[i]. Both would then call dev_kfree_skb_any() on it. TX completion has already dropped the stack's reference, so that skb only holds the skb_get() reference.
On phylink ports the window is limited to an xmit that started before netif_tx_stop_all_queues(). That window is not bounded on PREEMPT_RT. mvpp2_cleanup_txqs() already has the same missing TX quiescence on these paths, but the flush adds a new unsynchronized writer.
Should TX be quiesced before mvpp2_tx_hwtstamp_flush() runs on these paths?
[Severity: High]
This isn't a bug introduced by this patch, but concurrent transmits also do not appear to protect this per-port array.
port->tx_hwtstamp_queue[] and its next index are per-port. mvpp2 is not LLTX, so the core holds only the per-txq lock. XPS maps each CPU to its own txq, so mvpp2_tx() can run on several CPUs at once.
The only driver lock in mvpp2_tx() is conditional and per-thread:
if (test_bit(thread, &port->priv->lock_map)) spin_lock_irqsave(&port->tx_lock[thread], flags);
That lock does not serialize two threads in mvpp2_tx_hw_tstamp().
If two CPUs read the same queue->next value while skb[i] holds a pending skb, could both call dev_kfree_skb_any() on it? If skb[i] is NULL, one skb_get() reference would be overwritten, and that skb and its socket write memory would be leaked.
The slot-reuse free in mvpp2_tx_hw_tstamp() also looks like it can race with the consumer in mvpp2_isr_handle_ptp_queue():
skb = queue->skb[id];
queue->skb[id] = NULL;
if (skb) {Once TX HW timestamping is enabled on the port, a process without any capability can set SO_TIMESTAMPING with SOF_TIMESTAMPING_TX_HARDWARE and send PTP frames from several CPUs.
The new flush adds another unlocked accessor to this array.
Quoted 4 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +4
-0+ } + } +} +
[ ... ]
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_stop(struct net_device *dev) · line 4933
Quoted 5 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1
-0@@ -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);
[Severity: Low]
This is a pre-existing issue, but the stop path does not touch the hardware PTP TX result FIFOs (MVPP22_PTP_TX_Q0_R0..R2 and the Q1 equivalents). It also does not reset queue->next.
A stale record for a reused slot could be matched to a new skb after reopen. That happens the same way with or without this patch. In practice, mvpp2_open() normally drains latched PTP causes before TX restarts.
The effect specific to this patch is smaller. Some timestamps have already been captured by the hardware but not yet read when the port stops. Those records now find a NULL slot in mvpp2_isr_handle_ptp_queue() and are dropped, instead of being delivered to the original skb.
Would it make sense to drain both hardware queues with mvpp2_isr_handle_ptp_queue() before freeing the remaining skbs here?
Quoted 3 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +0
-0if (!port->has_tx_irqs) {for (thread =0 ; thread < port->priv->nthreads; thread++) { port_pcpu =per_cpu_ptr (port->pcpu, thread);
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103100535.1310088-1-vulab%40iscas.ac.cn
Simon Horman
reviewerQuoted 5 lines · On Sat, Nov 07, 2026 at 12:00:58PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 (1) · Medium: 0 · Low: 0 (1)
Quoted 8 lines
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] The new
mvpp2_tx_hwtstamp_flush()(drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:3422-3436) checks,…
I lean towards this being a pre-existing issue that can be handled separately from this patch. But I do note that taken at face-value it severely impacts the reliability of the teardown path and the usefulness of this patch in practice.
Quoted 4 lines
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a serious race on the same data.
- [Low] Baseline decision: not a valid finding against this patch.
...
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 3 Nov 2026 10:05:35 +0000 you wrote:
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 bymvpp2_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.[...]
Here is the summary with links:
- net: mvpp2: free pending TX timestamp skbs when the port is stopped
https://git.kernel.org/netdev/net-next/c/6c4f0baee69e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html