Skip to contentSkip to conversation

Please apply commit 4db79a322db8 ("net: gro: don't merge zcopy skbs") to 6.1.y

PATCH Applied Salvatore Bonaccorso 2 participants 2 messages Jun 2 – Jun 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

4db79a322db8 ("net: gro: don't merge zcopy skbs") was backported to various stable series (6.6, 6.12, 6.18 and 7.0) but not to 6.1.y as it does not apply cleanly. With adjusting context the change applies, proposed change below.

Does that looks good, and can you pick up the change as well for the 6.1.y series?

Regards,
Salvatore

From d6ad94fa8c6ff9c191e5545bc6277d2e3c75b811 Mon Sep 17 00:00:00 2001
From: Sabrina Dubroca <[email protected]>
Date: Wed, 20 May 2026 22:44:42 +0200
Subject: [PATCH] net: gro: don't merge zcopy skbs

[ Upstream commit 4db79a322db8c97f7b73b8a347395ef4d685eb40 ]

skb_gro_receive() can currently copy frags between the source and GRO skb, without checking the zerocopy status, and in particular the SKBFL_MANAGED_FRAG_REFS flag.

When SKBFL_MANAGED_FRAG_REFS is set, the skb doesn't hold a reference on the pages in shinfo->frags. Appending those frags to another skb's frags without fixing up the page refcount can lead to UAF.

When either the last skb in the GRO chain (the one we would append frags to) or the source skb is zerocopy, don't merge the skbs.

[Salvatore Bonaccorso: Adjust for context in 6.1.y series without e8d4d34df715 ("net: Add netif_get_gro_max_size helper for GRO")]

---
 net/core/gro.c | 3 +++
 1 file changed, 3 insertions(+)
net/core/gro.c +3 -0
index ea6571c01faa..c5a9733d929a 100644
@@ -171,6 +171,9 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
 	if (p->pp_recycle != skb->pp_recycle)
 		return -ETOOMANYREFS;
 
+	if (skb_zcopy(p) || skb_zcopy(skb))
+		return -ETOOMANYREFS;
+
 	/* pairs with WRITE_ONCE() in netif_set_gro_max_size() */
 	gro_max_size = READ_ONCE(p->dev->gro_max_size);
 
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 3 lines

Please apply commit 4db79a322db8 ("net: gro: don't merge zcopy skbs") to 6.1.y. The mainline commit does not apply cleanly there, so a hand-crafted backport is inlined below.

Queued for 6.1.y, thanks.

Signature · 2 lines
Thanks,
Sasha