FAILED: patch "[PATCH] net: macb: drop in-flight Tx SKBs on close" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 27f575836cfebbf872dec020428742b10650a955
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072141-computing-awaken-54dc@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 27f575836cfebbf872dec020428742b10650a955 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= <[email protected]>
Date: Thu, 2 Jul 2026 17:37:02 +0200
Subject: [PATCH] net: macb: drop in-flight Tx SKBs on close
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The MACB driver has since forever leaked the outgoing SKBs that have not yet been marked as completed. They live in queue->tx_skb which gets freed without remorse nor checking.
macb_free_consistent() gets called in a few codepaths, but only close will trigger the added expressions. In macb_open() and macb_alloc_consistent() failure cases, queues' tx_skb just got allocated and are empty.
drivers/net/ethernet/cadence/macb_main.c +19 -2
@@ -2668,8 +2668,25 @@ static void macb_free_consistent(struct macb *bp)dma_free_coherent (dev, size, bp->queues[0 ].rx_ring, bp->queues[0 ].rx_ring_dma);for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) { -kfree (queue->tx_skb); - queue->tx_skb =NULL ; +if (queue->tx_skb) { +unsigned int dropped =0 , tail; + +for (tail = queue->tx_tail; tail != queue->tx_head; + tail++) { +if (macb_tx_skb (queue, tail)->skb) + dropped++; +macb_tx_unmap (bp,macb_tx_skb (queue, tail),0 ); + } + + queue->stats.tx_dropped += dropped; + bp->dev->stats.tx_dropped += dropped; + +kfree (queue->tx_skb); + queue->tx_skb =NULL ; + } + + queue->tx_head =0 ; + queue->tx_tail =0 ; queue->tx_ring =NULL ; queue->rx_ring =NULL ; }
Sasha Levin
maintainerPATCH 1/1 net: macb: drop in-flight Tx SKBs on close
From: Théo Lebrun <[email protected]>
[ Upstream commit 27f575836cfebbf872dec020428742b10650a955 ]
The MACB driver has since forever leaked the outgoing SKBs that have not yet been marked as completed. They live in queue->tx_skb which gets freed without remorse nor checking.
macb_free_consistent() gets called in a few codepaths, but only close will trigger the added expressions. In macb_open() and macb_alloc_consistent() failure cases, queues' tx_skb just got allocated and are empty.
--- drivers/net/ethernet/cadence/macb_main.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +20 -2
@@ -2582,8 +2582,26 @@ static void macb_free_consistent(struct macb *bp) bp->macbgem_ops.mog_free_rx_buffers (bp);for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) { -kfree (queue->tx_skb); - queue->tx_skb =NULL ; +if (queue->tx_skb) { +unsigned int dropped =0 , tail; + +for (tail = queue->tx_tail; tail != queue->tx_head; + tail++) { +if (macb_tx_skb (queue, tail)->skb) + dropped++; +macb_tx_unmap (bp,macb_tx_skb (queue, tail),0 ); + } + + queue->stats.tx_dropped += dropped; + bp->dev->stats.tx_dropped += dropped; + +kfree (queue->tx_skb); + queue->tx_skb =NULL ; + } + + queue->tx_head =0 ; + queue->tx_tail =0 ; +if (queue->tx_ring) { size =TX_RING_BYTES (bp) + bp->tx_bd_rd_prefetch; dma_free_coherent(&bp->pdev->dev, size,
Signature · 1 line
2.53.0