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 EB2CB31DD97; Thu, 28 May 2026 20:31:41 +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=1780000302; cv=none; b=P+bT1sYAo7uXc8kXgcPjP6sF6MmrMoo+EIABn7PxbhkAiRdeH92zUNcx71JwIfUuF4+W3+g1yZGhelv+bSdWIPorZ+8T5xLzX99BDzFk7nFtXOeVZbh67C3+5wPKijA8UyTZ0Cc3hCsrHYJAo8hHmCR9DrR/tdYN0Bb8Fis9jW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000302; c=relaxed/simple; bh=KpN5t9Q7zxxQa+3sUAF73JPvIDQgTmDblgRlE9pg/cU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mCwBtHnHL9PRxwLalR7cwZBUqC9+PZQHVGucuF5i278fgw/jafewmR2vAbHsmYRKNu1Qbso/F9aCwAANz70npZwZ++Ljk4jdRMwiHYgyH4BwIPkvThocmdhT04niUNN8M4o92wDI+JagnoLascTlpjwssKF+W5bidvtH3tMSdmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mJhk4VDH; 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="mJhk4VDH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 547DF1F000E9; Thu, 28 May 2026 20:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000301; bh=KbqpRcjXIahw5vS9tIPISdv6synbIJCBnJrf12ElNK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mJhk4VDHy7aBgBxJd30XKHBOGCJRPrjrzDiP97oJI+4xwtpp8K6mEa2jPVU50g8Fm TT6j7aRm0kkxShzKYD79PH0a1GHL4EwTlozJ1j/9AiC9FgJiCGrlAdSxEuTnNu+CYu yzWLlg3sMV7MKOYkL7NuTzLA0OqBX5YmnIiKVTuU= 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 , Sasha Levin Subject: [PATCH 6.18 374/377] net: gro: dont merge zcopy skbs Date: Thu, 28 May 2026 21:50:12 +0200 Message-ID: <20260528194649.259609463@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 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 867611d171dbb..b5f790a643d49 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -109,6 +109,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; + if (unlikely(p->len + len >= netif_get_gro_max_size(p->dev, p) || NAPI_GRO_CB(skb)->flush)) return -E2BIG; -- 2.53.0