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=1796387342; b=Vjjqmt0sKlHgzjO1NY7P8mAlXA7m/ugkOzIMux0OVzVjmtTRKEQIimGz8Nvn63WLjPfx ii6WJdFAvhIAVOS9HnoeMDAo2a+LZdN1+vwVwRqH/OxL6UupfQqgY2rmMfecMZnZqdmiZ F70NXhf8v0Z+pPhN7ptDJocK9e1oWRO2zD+Dd5BwKcPeWRf/HMjeZnU1UhhXqtB7HGwvp ojy3N21TKBg4vKSbZDP3RwhAoRplhoGcW3Qv7p+DVw6xTD8ALXo8hcA3uY+CkMBCFJhrh EkotEYzewfpP/QY+ff7pUkOXDh9stGWy8pILjLwOhj9WQFT/dMgthvHnzr9//0mf3Tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387342; 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=jC2hZpqL6lC4tRZWOyc8WFinSZXkmKDXReJi6Sj+nXE=; b=txlt6iFzX+ikCUkwJZuUmb6vw5XuKE7sVQb3b9o4axoQr2uRpuEdntuQXC5l4DMzy7xO HY/LPs+0iWoisaRC+Fs2nwleOhZvxJmzESW5GWIYNgcvA3TnxKzL5VD+mqEjk8RUMPFxn Tc6HutiOUAKBM/o1LNlfxwGIW8NrMlS3g0wMdx9N3QnoYFOWnBBd1FbcIaRoRxNVuTfDc v4i135QE3zQAzCheKMJZ+YGcjd2VO1JIdySyjNcE1+/x20uRsJwuDow2f9A4ms62Z8TEs 9qmabbLO3HZmRNq/0AoN7C5HXYmuJX/Q6BHb8A5Ow5o9AP06F4bbV93xWzWTU6IOhNQ== 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="T/fjUaUk"; 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 26DE6606A32C; Fri, 4 Dec 2026 12:29:02 +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=T/fjUaUk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 950E71F000C2; Fri, 4 Dec 2026 12:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387342; bh=jC2hZpqL6lC4tRZWOyc8WFinSZXkmKDXReJi6Sj+nXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=T/fjUaUk7s13UI01RWX1hdX216zQtidTeZvLvm3LWB6w/4TiHSOLf6VLURnpD7TF3 om4kGl95kfH5zi1YgHXIFmPgMJ/Fbp2bkS56t0nanY4ERs7vSsPUuyVXjcnAmRfxSD t0sWJQGh5IB8BxO6SWQeDxtkAY/Ga7ATibe2kB3Y= 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.1 0188/1059] net: gro: compare skb->protocol in gro_list_prepare() Date: Fri, 4 Dec 2026 18:55:19 +0900 Message-ID: <20261204100649.151130290@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 4c62828b45045..c71cb2ff960e4 100644 --- a/net/core/gro.c +++ b/net/core/gro.c @@ -421,6 +421,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