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=1796387397; b=qKa0DU1pQdwO+NxJGcOxA69V6ro7MIOOF69Rs+mJwelZuN37HlgBqtiwVmGf2CkSO/To WxZgFirJk3S5cwuagwM87yrJ2uNviierpz8EU691/byk8wvWN5cSA08bOiUxcWbbu3n22 3dxWKpBPeJdBIVMdGH7Qu6Cze0sTzKaPqOKAjZjY8c3m82IHRZv/gg7g6ZCfRrtYFoUhB kY5PQXjkn2i+zKvvcqKOBN50y6R13MlZ7Vw67trHio7WwFXir6mNWZg/xTELzCQKcb927 YcJmNU8YyrKJl7quDTG7xrCi3FlKibgrDka84IuKTApFx7VD49NPiAWFLc6Mv0aQgIQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387397; 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=elOx6XFNbuwwNTT4D6JYa8y2rRFnpV2RYYBXlXlqwbI=; b=L8dR0HZ5HxTy+oHikBor6xh826HmY39nE4NRFCcljuNkQVm3OgpiiBXXfzZug0y50V1l AGo1wAr6iWMlTBcjpuWaLHP/WFLQVocjEtaqkIHWGGM0hrPDcTh7+nAH5F/3nB4nMDJ60 C2kENXblSgwP9IciFYBOpTBcLLqgUTjDYiaZ5gq/Vi6T7jrOg+BX10+1WrPDeSot6s0j1 DBkveTh/Ia6fIN4hoxf9JmeuMUwC9x1yXuKTTLLcBBtz0JMoxxHyYY+MccSFcGCp6zwgq phvvG1X5LW/HdOczZsOuWwLF/nftNLrH0WuRFLpUjwd3LP/DemeKHEY9UHg4WYytZ0w== 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=EIBvEcFE; 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 B3F76606A322; Fri, 4 Dec 2026 12:29:57 +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=EIBvEcFE Received: by smtp.kernel.org (Postfix) with ESMTPSA id D24071F000C2; Fri, 4 Dec 2026 12:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387397; bh=elOx6XFNbuwwNTT4D6JYa8y2rRFnpV2RYYBXlXlqwbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EIBvEcFE2f7q78xoR9zGYfz4lTPzA6GTDUeojd0JAna8AG320Gw1lirWYJfRLIH8H PNf5wcA3+nXYhiiCXjgGnywuopZOOnCq9gxhiRt+w8rrnF8GBG0mQX0rh+bMVkxjTc ZoIQoo5LyJcUXAcbURx8L80QkkxjEf/MoBeNBXAE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , Eric Dumazet , Willem de Bruijn , Dave Miller , Sasha Levin Subject: [PATCH 6.1 0190/1059] udp: check frag_list IP family before using skb_segment_list() Date: Fri, 4 Dec 2026 18:55:21 +0900 Message-ID: <20261204100649.200608799@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: Kyle Zeng [ Upstream commit 22b7cb932c6a0f7566d41072be6956cb6c8af4e1 ] UDP fraglist GRO uses SKB_GSO_UDP_L4 for both IPv4 and IPv6. __udp_gso_segment() reuses the frag_list skbs when the geometry of the head skb was not modified. skb_segment_list() keeps the network header of each frag_list skb as it was at GRO time and only adjusts the transport header offset. Nothing guarantees that the head skb still has the IP family of the frag_list skbs: helpers like skb_mpls_pop() let the caller choose the new protocol. In that case __udpv6_gso_segment_list_csum() handles the 20 byte IPv4 header of each frag_list skb as a struct ipv6hdr, and can write IPv6 addresses beyond its linear part. Check the IP version of the first frag_list skb. All skbs in the list belong to the same flow, so they share the same IP family. Use the skb_segment() fallback on a mismatch. Regular fraglist GRO traffic keeps the fast path. Fixes: b936a9b8d4a5 ("net: ipv6: fix UDPv6 GSO segmentation with NAT") Fixes: c3df39ac9b0e ("udp: ipv4: manipulate network header of NATed UDP GRO fraglist") Signed-off-by: Kyle Zeng [edumazet: simplified the fix, rewrote the comment and the changelog] Signed-off-by: Eric Dumazet Reviewed-by: Willem de Bruijn Signed-off-by: Dave Miller Signed-off-by: Sasha Levin --- net/ipv4/udp_offload.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 1a920ade779f4..cf4f686d2fc3e 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -352,9 +352,14 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, } if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) { - /* Detect modified geometry and pass those to skb_segment. */ + /* Detect modified geometry and pass those to skb_segment. + * SKB_GSO_UDP_L4 is used by both IPv4 and IPv6: also make sure + * the frag_list skbs still have the IP family we segment for, + * as their network headers are not rebuilt. + */ if ((skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) && - !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY)) + !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY) && + ip_hdr(skb_shinfo(gso_skb)->frag_list)->version == (is_ipv6 ? 6 : 4)) return __udp_gso_segment_list(gso_skb, features, is_ipv6); ret = __skb_linearize(gso_skb); -- 2.53.0