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=1796381184; b=diELYOTB/RLz0T9Yx6zBUlExr/eGCh0pZiVYFALy9XyzwpEEiIZtQxZmCcN2dQcWMYLa ZxDNQ+OFkGmyDSl0iW2pz0J6Iy0ljR/+38IhChhILLUQ29/olpXgXbHT8Ms+mGwf42chk ckJPSWuShLQVg6M0V90YL3kjai/Gom1EW9DK0X/j2ppIm7vqMj+i95mw0J3SrWF+3w0TS yn9s69HCZZLoUIAnduCH7csdhwa3+qeuw0riwH+Y7bbRRao852emjnaF/SBfAFOlRrZ1W 6KBI5HWteuaaNHe0CkCEzQ2F7lHCwlqvSRI80XeIwTwGG9Nfag7w9/GH2tQ8qteVQAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381184; 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=SSsOzAWMj5JB0nM8FoabmotiXKfdijPNwVsxOe3gmc8=; b=xWyxcioNrblOUsGzzgedDfUiRjtrxHIMsfPPGRQXXoDcSi2xJ+zAghAj/wKB4gXJPBy4 DweyEXAK2rKjZfmRkSsWPZYarRpd/9B0vf5D6OmmliOZEJwN1RdYS9qWP0OKQ6yJVN5rU ju/uYfOD3SGtXZWUh/m40zlt8Q6hNaxqzkv2v/j4fdbG/n+nkbAY0Leiv23ntDF1u9RLO CzxUxLxDSBXmEpNEqxawe1EIi4NeXtXykDaQ+o+5gMF0Ts9S03xlxAxMrrlfg9zJkWujT adkph3MNj7dNzxrhk5ZjQPSc4mK0DCq++4Ul+6CNWu4XFYylkqonxO74ViJGb+2/XmA== 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=vG7akibd; 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 09151606A322; Fri, 4 Dec 2026 10:46:23 +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=vG7akibd Received: by smtp.kernel.org (Postfix) with ESMTPSA id 359AD1F000C2; Fri, 4 Dec 2026 10:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381183; bh=SSsOzAWMj5JB0nM8FoabmotiXKfdijPNwVsxOe3gmc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vG7akibdJcGvilu2idE3awsQuzzp2ydj9bzp4D7Kth+zA1qf9iFeuSkcE3bUEeIuX MbuOLFugapS2zXHxsYbOFuDSzqQ+mRgx9odqbXmYex02eQV4RQmzC0Fm7B1Q2Tg4rK 7Chcr93ujXXlElM+cfy+ykA8o5e42Trn8nI2Tts8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Justin Iurman , Paolo Abeni Subject: [PATCH 7.3 595/742] sctp: use skb_set_transport_header_careful() in sctp_v6_err() Date: Fri, 4 Dec 2026 19:07:39 +0900 Message-ID: <20261204100650.930770246@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 13391f1a8c584e7c1addaea3fd47105d92cc724c upstream. 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. sctp_v6_err() stores @offset, computed by icmpv6_notify() from the extension headers of the packet embedded in an ICMPv6 error. Should the value be truncated, sctp_err_lookup() would read the SCTP 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 ignore the ICMPv6 error if the offset can not be stored. Do this before changing the network header, so that nothing has to be restored on failure. Fixes: 1a37e412a022 ("net: Use 16bits for *_headers fields of struct skbuff") Cc: stable@vger.kernel.org Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20261113124625.4010206-5-edumazet@kernel.org Reviewed-by: Justin Iurman Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/sctp/ipv6.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -170,8 +170,11 @@ static int sctp_v6_err(struct sk_buff *s /* Fix up skb to look at the embedded net header. */ saveip = skb->network_header; savesctp = skb->transport_header; + if (unlikely(!skb_set_transport_header_careful(skb, offset))) { + __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); + return -EINVAL; + } skb_reset_network_header(skb); - skb_set_transport_header(skb, offset); sk = sctp_err_lookup(net, AF_INET6, skb, sctp_hdr(skb), &asoc, &transport); /* Put back, the original pointers. */ skb->network_header = saveip;