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=1796228154; b=24EwIxhlumFDaCyBGQ0Xb088ojxKobmDi0h4wx2xVlsEQT3GS510mOfIWTz4lZJFGlRa JqV4JNIV8dJU1j5Qj1iv4s9CmVP+D8LvUnkG/d/i5sZAUmt68paFrbjN+rydDdPq44ycV AKuPAcXzddiJftjs0P+DY0/gzKXALAhXzst714uregNOgnqCapZgW4mGP8EzToP9N1PaP 0MY162Ix0vB5+qfuoHUqPMGQlTk/z9EbRGffbTZsy7Hy1l/p+XFIVj2I9S2KJJFcSL+FK ohTcQ2xjnoGhaPItq5geEubNEDeE6O9zQEOq5JyZi0uhs/NT9t6xSrXMZQinxZBm19A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796228154; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=oIEoPpGL2MMI7MAzzIzss34tTH0VQYhS0N02LfIT040=; b=z8pF3GnLLJwJM7SAty75YBCCObpg/PtOUDLga6hUqN6MN2vSU41aJWvhY+INTN1ySyRX RAB54TsfcUiCTCgXILMMgPb1iFoowYVg3T4s01TR6zcgcHdDXAEy2koozUwcS0y1BKlc7 bN3GbaQg5qwuXvXgDPcY//Xu+wW+W57O+nsYD9B1EF2+loIkqMiSzFD/iZDvNHYioDLMo RhbNz72x4sbc4foxAKBVyAT4Xe77EY9Gxny8JLMD1jcX0b0RSl2epgwEAJefJTyoKhrQn daNbAmSjUpjkXke3jUy7aZIipD/8hFq/CuhhKSQYy+jxJvCb8Hjy7kUarlVUaMuXdow== 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=mXBIXCv6; 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 B7456606A31A for ; Wed, 2 Dec 2026 16:15:54 +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=mXBIXCv6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A171F00899; Wed, 2 Dec 2026 16:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796228154; bh=oIEoPpGL2MMI7MAzzIzss34tTH0VQYhS0N02LfIT040=; h=Subject:To:Cc:From:Date; b=mXBIXCv6fQGO9ChTXFW/IpNy73NGyc02u3t1o5+z5M6H42JiViEizYKEqfMtJczC8 4B2hwYbYJNF4ejD9wVjbOatJCPEsdHQa5+lUR/18iPUgxR/M8q2ub1kp1Tu1GtKI4F eo1/hAXRJ83e3KC5K2uo2FxH6iKK/LA/shkkGogM= Subject: FAILED: patch "[PATCH] udp: use skb_set_transport_header_careful() in" failed to apply to 6.6-stable tree To: edumazet@kernel.org,justin.iurman@gmail.com,pabeni@redhat.com,sbrivio@redhat.com Cc: From: Date: Wed, 02 Dec 2026 16:15:03 +0100 Message-ID: <2026120203-snowbound-duration-4fc5@gregkh> 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-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 02f578b736f1524ed73ef879fb1cf1ba4a875aa4 # git commit -s git send-email --to '' --in-reply-to '2026120203-snowbound-duration-4fc5@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 02f578b736f1524ed73ef879fb1cf1ba4a875aa4 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Fri, 13 Nov 2026 13:46:25 +0100 Subject: [PATCH] udp: use skb_set_transport_header_careful() in __udp6_lib_err_encap() skb->transport_header is a 16-bit offset from skb->head, and U16_MAX is reserved as the "not set" value. skb_set_transport_header() silently truncates an offset that does not fit. __udp6_lib_err_encap() stores @offset, computed by icmpv6_notify() from the extension headers of the packet embedded in an ICMPv6 error. Should the value be truncated, the tunnel encap_err_lookup() and err_handler() callbacks would read the UDP header at the wrong place. Since commit 3744b0964d52 ("ipv6: Implement limits on extension header parsing") a single chain is bounded to IP6_MAX_EXT_HDRS_CNT headers (24576 bytes), so this needs a large skb->data - skb->head on top of it, for instance after several nested decapsulations, each of them possibly pulling its own extension header chain, since @offset is relative to the IPv6 header embedded in the ICMPv6 error. No reproducer was written, this is hardening. Use skb_set_transport_header_careful() and return an error if the offset can not be stored, in which case udpv6_err() ignores the ICMPv6 error. Do this before changing the network header, so that nothing has to be restored on failure. Fixes: a36e185e8c85 ("udp: Handle ICMP errors for tunnels with same destination port on both endpoints") Cc: stable@vger.kernel.org Signed-off-by: Eric Dumazet Reviewed-by: Stefano Brivio Link: https://patch.msgid.link/20261113124625.4010206-6-edumazet@kernel.org Reviewed-by: Justin Iurman Signed-off-by: Paolo Abeni diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 9dcefa162522..a6886a0432f9 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -651,12 +651,13 @@ static struct sock *__udp6_lib_err_encap(struct net *net, network_offset = skb_network_offset(skb); transport_offset = skb_transport_offset(skb); + /* Transport header needs to point to the UDP header */ + if (unlikely(!skb_set_transport_header_careful(skb, offset))) + return ERR_PTR(-EINVAL); + /* Network header needs to point to the outer IPv6 header inside ICMP */ skb_reset_network_header(skb); - /* Transport header needs to point to the UDP header */ - skb_set_transport_header(skb, offset); - if (sk) { up = udp_sk(sk);