From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD0CD47AF67; Tue, 16 Jun 2026 17:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781630679; cv=none; b=tHPo0eYDjMpc6dJLAc+IjAhyZXKs0Rfu1juoREgGuxJ6nnGgtrKnRyMEyUV4mATMpe/YmQwzpqxt+ogsCFllbIaVWq5EWUkET6+LSi/6jPwYKYA7DHISrsAH5nQpYd7XjgiusiX5llC+K/WXTNJSgsbkq3mW6jJV4xU6DmZPTcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781630679; c=relaxed/simple; bh=u+sfRQKgPzkaX2LpEMJReCL1YSLBSCzCB0bqrQBdmos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=epu5OtYeqbcpRAD7q+v7Cu5xoZRmAdoGVQcrkv5RGuyudeKp6BnZOXxpWFcnH3/OSpETnbfo56U7zQ2bLTKMTIsFKICoXdSI4BRWTsAa3FWMHqRFjBsC7S9EN60dj8SauxaIjaVMfyby7We+EEPbzvD66ATCPPWpJNmM2eZ1rfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oUQlAeDb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oUQlAeDb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A76AC1F000E9; Tue, 16 Jun 2026 17:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781630678; bh=Rf2Myay6RTuJYBdNDNCnslpsIHT4aNGGgA6JupM0Anw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oUQlAeDbHW9bDRQFEX1cfKwm+VKXhHi3/RhbJ58/lRT3RKacZWMEQRkcRCCj1T9Jd lO9tQLu5cIujFDW6S7fslE6wxBEv6HsP9kgs+mWh8mvT8605JLcbAKOIOv8jfQdjw3 q1Uym0/9iU89EintFOfnxdKiSSbgCokMqCq2kowg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Huzaifa Sidhpurwala , Sabrina Dubroca , Willem de Bruijn , Jakub Kicinski , Salvatore Bonaccorso , Sasha Levin Subject: [PATCH 6.1 076/522] net: gro: dont merge zcopy skbs Date: Tue, 16 Jun 2026 20:23:43 +0530 Message-ID: <20260616145129.398854587@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sabrina Dubroca [ 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. Fixes: 753f1ca4e1e5 ("net: introduce managed frags infrastructure") Reported-by: Huzaifa Sidhpurwala Signed-off-by: Sabrina Dubroca Reviewed-by: Willem de Bruijn Link: https://patch.msgid.link/c3b7f906bbfcbdfd7b4fa9d6c18a438870df85be.1779307748.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski [Salvatore Bonaccorso: Adjust for context in 6.1.y series without e8d4d34df715 ("net: Add netif_get_gro_max_size helper for GRO")] Signed-off-by: Salvatore Bonaccorso Signed-off-by: Sasha Levin --- net/core/gro.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/gro.c b/net/core/gro.c index ea6571c01faa9e..c5a9733d929a95 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -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); -- 2.53.0