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=1796384677; b=WDVWv4Hre9Wr+U2POVVxvfijY3pTpyIAepqfg1cfIH2XFYGjt4+EID2MvQuk/o1h/HYA cvqHEVcaLjW3zbu80wEncPsEF/U9TnydPjIMyWftkR4890vAhEXTvZw/6+lZ9+Ro7IjBJ sxSLM69oJRa4QZCZzDL1tKbayLchZL4irV6NM1pgdObTVP9xtxfB85W4XA0EWL4f4Vh0u sLNIlRfEmfMkZLSpDefdWjOZ4JhDzfcXWatlNlqTuAjKvz69ip7Rwkc6/p5cIP/xSPn/K jErs2dYVMwa3UAf/LD/drBytEIzdjgZCw5/xF4OWoc2qdIpX/qg6BV0UOGlXsxX1XCQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384677; 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=0rnx1UIWatQNKSmTDY31PcLD1TIjUtcG2N/CdhCaPu4=; b=0YYr0OGiMJf2Eb6jnAk0MJBur+K5yit3dyOkwH215c8qHY+4HwvLKnQ7KBnsFIXCe8Fa T5zC/+aH0t2z1qWGrWR75WoRoiwCEzs+5GJPSUUtj6j66Q+YVJvc2iW/WXJsPg0qeIwLM Xzp4oGHC3PmU3ZdcBPYO0u766AP4pjMj8t4as44vE8eWDNGyWf/Z5H7VKtEOVpEP8tGvn gLgsKzp7S02ElwRLM6TbgOjc/vZZgcJVt3NE2YtIMjTPrAHESJD+nGwKbBy278HZiV0Rb Wl2GJJ8ZatWZuttTK2F2d++sFj03X0jd6IukluSVXeiFwqyAywVJC4AF5sFdBtHJeLw== 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="YR/Wr/7j"; 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 6EFA5606A32F; Fri, 4 Dec 2026 11:44:37 +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=YR/Wr/7j Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDF7A1F000C2; Fri, 4 Dec 2026 11:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384677; bh=0rnx1UIWatQNKSmTDY31PcLD1TIjUtcG2N/CdhCaPu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YR/Wr/7jZSIDooIDacR/M1oOIKiQyJ1i+uYX1QHkb66Zlygxx8diC2LxkZk8BzZ9k pV99vxhrAKDyGiHxsxHm1CLLlDekW6Tc2xwXwP2q9bI47GYc99wX5puLuDW++hfvVz UnuT7P/tE1/hcDeF1OKSHRhhJuDpUKE3VGtFLq1U= 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.6 0247/1167] udp: check frag_list IP family before using skb_segment_list() Date: Fri, 4 Dec 2026 18:54:34 +0900 Message-ID: <20261204100708.500370371@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: 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.6-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 dec65fb8a0e42..0f08d7dfe6128 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -353,9 +353,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