From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384671; b=C5a/VA4dM94GB0mcn1MJcUEYlDw9izpD+sHPf7A7J2S4plQ9WOUB9e1Zv6MdvLz1fO0v /wReM6gYQByAGFE6M00foqOWA0/hp5905HSO/X7Omm9d05QUrJyRzd2B1octFw1NAvKvZ 1APHtpPaCmZUTTwEa+jIeoOe/XWfhkGFmHyvxaW2vjmx721YRs4UPOziVBf/632VKqCGh g0dTrlpGaOvChR6ENNr70z9qO8D26xcFhTU/FezeBfAsrDMUG37ivH4gWaYio6XHH63Nf pFiOXIpuM5NYoiWzqqhD4fBbFJaIX3Y524+05kQknDkO8K2Zm2ylsSt9HH+6yVoU9NA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384671; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=NcR89abZwUsRrAjj/jRhTpTj20WS/WAtLIpg70hdShs=; b=rKS/vStwD2YozYziSyJ9VIkZkv1pkdw091YoID/dpYk9LwIDPWznixqLu2wcycaJVlXV GOM6S5D3uBC8QVbPFW+DFtckaTf3SydsklMcwLciG6lr/yUKYo9y36LllxEpS+jluA/Dd f2vsIzJ//R/o+1BKLlRt/a2TWeHIB7P9kmJbA13zvZB0+HrfxOk9+T3PTnpGnO/mVVKCX 3Evg+UtnND5Z4047Wh5MfVHBVGKM3FBNvJUqYlLadpyDzfCcoY7JIOlIORA+I7h2i2tSo sCV6PKP5/vgU4pcuTqN/3e5lvoUvjr23JbvBdBpvNXYsGQEWZxcxqMoEkZQzLkxieYQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hSpGj0A1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEA83606A322; Fri, 4 Dec 2026 11:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hSpGj0A1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E67751F00935; Fri, 4 Dec 2026 11:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384671; bh=NcR89abZwUsRrAjj/jRhTpTj20WS/WAtLIpg70hdShs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hSpGj0A11pe5ov1taIQg6m2JT6Wvywdau9x7D4Nsns1rJARrye/eoZHoSWN1VKKAi u1f+xECr0yfQO0JXtw7uV5d/EFNj41eDSEql5YFTTtLIwxMdjPtjn7OJr5T98wbAqX gG/W4I68Lgoqp2qoNseH+Ss3xq4V0zuZD2Q8JyNs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Willem de Bruijn , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 0245/1167] net: gro: compare skb->protocol in gro_list_prepare() Date: Fri, 4 Dec 2026 18:54:32 +0900 Message-ID: <20261204100708.449949130@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 511582022bfd07475d0daa209e6e6aa5a940740d ] gro_list_prepare() checks whether a held packet may belong to the same flow as the incoming one by comparing the device, VLAN tag, metadata and the link-layer header, using dev->hard_header_len as its length. On devices without a link-layer header (hard_header_len == 0), such as L3 GRE tunnels, no compared byte carries the outer protocol: skb->protocol comes from the tunnel header. Packets of different protocols can then stay eligible, and the GRO handler selected from the incoming skb->protocol parses the held packet with the wrong layout. For example, take an IPv4/UDP packet held by UDP GRO and a VLAN/IPv4/TCP packet received on the same ipgre device. vlan_gro_receive() reads the first four bytes of the held IPv4 header as a VLAN header. With crafted values, the held packet survives up to tcp_gro_receive(), which uses its UDP header as a TCP header. With a short linear part, the FIN/PSH update of the held packet's TCP flags can then write into skb_shared_info. The VLAN, GRE, IPv4 and IPv6 GRO handlers compare the next-protocol field of their own header, so once the outer protocol matches, the inner layers are checked too. Only the outermost protocol was not compared. Compare skb->protocol too. On Ethernet devices this is redundant with compare_ether_header(), but it is cheap. GUE direct IP encapsulation has a similar issue, but there both packets have the same outer protocol, so it is fixed separately in gue_gro_receive(). Fixes: 60769a5dcd87 ("ipv4: gre: add GRO capability") Reported-by: Kyle Zeng Reviewed-by: Willem de Bruijn Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20261109164540.3104392-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/gro.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/gro.c b/net/core/gro.c index f2dc3e633044a..755496f53415e 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -378,6 +378,7 @@ static void gro_list_prepare(const struct list_head *head, } diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev; + diffs |= p->protocol != skb->protocol; diffs |= p->vlan_all ^ skb->vlan_all; diffs |= skb_metadata_differs(p, skb); if (maclen == ETH_HLEN) -- 2.53.0