FAILED: patch "[PATCH] net: stmmac: drop the rest of the frame when napi_build_skb()" failed to apply to 6.12-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.12-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.12.y
git checkout FETCH_HEAD
git cherry-pick -x ece404eac250fc4be7aa4cec82e8c248cca83c28
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026120213-cherub-disarm-03b0@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ece404eac250fc4be7aa4cec82e8c248cca83c28 Mon Sep 17 00:00:00 2001
From: Arun Iyengar <[email protected]>
Date: Fri, 13 Nov 2026 17:13:40 +0000
Subject: [PATCH] net: stmmac: drop the rest of the frame when napi_build_skb()
fails
If napi_build_skb() fails on the first buffer of a frame that spans several descriptors, stmmac_rx() drops that buffer but goes on with the next descriptor of the same frame as if a new frame started there. The rest of the frame is then passed up the stack as a frame of its own. A frame spans several descriptors when it does not fit in the RX buffers of one descriptor.
Mark the frame as errored instead, so that its remaining descriptors are discarded like those of a frame with a receive error. The frame is counted once in rx_dropped and once against the NAPI budget.
Found while working on the sun8i EMAC jumbo frame series, where frames over 2032 bytes span several descriptors. Tested on an Orange Pi Zero2 (dwmac-sun8i, MTU 4070), w/ jumbo series and error injection.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -6045,7 +6045,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) buf->page); buf->page =NULL ; rx_dropped++; - count++; + error =1 ; goto drain_data; }
@@ -6081,7 +6081,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)if (likely (status & rx_not_ls)) goto read_again;if (!skb) -continue ; + goto next;/* Got entire packet into SKB. Finish it. */
Sasha Levin
maintainerPATCH 1/1 net: stmmac: drop the rest of the frame when napi_build_skb() fails
From: Arun Iyengar <[email protected]>
[ Upstream commit ece404eac250fc4be7aa4cec82e8c248cca83c28 ]
If napi_build_skb() fails on the first buffer of a frame that spans several descriptors, stmmac_rx() drops that buffer but goes on with the next descriptor of the same frame as if a new frame started there. The rest of the frame is then passed up the stack as a frame of its own. A frame spans several descriptors when it does not fit in the RX buffers of one descriptor.
Mark the frame as errored instead, so that its remaining descriptors are discarded like those of a frame with a receive error. The frame is counted once in rx_dropped and once against the NAPI budget.
Found while working on the sun8i EMAC jumbo frame series, where frames over 2032 bytes span several descriptors. Tested on an Orange Pi Zero2 (dwmac-sun8i, MTU 4070), w/ jumbo series and error injection.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -2
@@ -5691,7 +5691,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) skb =napi_alloc_skb (&ch->rx_napi, buf1_len);if (!skb) { rx_dropped++; - count++; + error =1 ; goto drain_data; }
@@ -5729,8 +5729,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) drain_data:if (likely (status & rx_not_ls)) goto read_again; -if (!skb) +if (!skb) { + count++;continue ; + }/* Got entire packet into SKB. Finish it. */
Signature · 1 line
2.53.0