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=1796381020; b=0Wy6hgzGI18OysXSN7MsSLBK9DsCTYStpFjyVRjKuuye8U4Yc0c7kEDOoItNIrt1LG6Q 0VffXO5GzULDaBikx+kMeLUqm4MByMnP9IR4X1zzE9grRMybNj6A6qKYABpsvnxbJMQTy nfVG9/LVjFT0OQ/SQAQ7qxWyeO4oKUbscnYerb/Km4ZwVRrO9SRWFgWLoSeLU6nvSPfOe TcerWxp4GlMa+P2KO4s7deYGJRTJAdI/fHZkeir2/nKB/v9XiP9wZp9xF2GQv8yu06kHX AFCS31SBn7pMqGLEwBNTgPmmkwidVuSAbrUjQmnKZ/bzhWk2OBdF3quZnC7TDz9J+9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381020; 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=bG/zBSoa0XxcCrY1IOAdmcaZVaQ6h1R0imgDicfFWHI=; b=fSMlLfKAJnzsB+J2lWOBv9U0ydwPRdxyoAN86tru8jDB3fddzt0eX+wx2QQM40eMSKVK nlUiuOTGnS5hG8QS/W0tj5vwz/FaN/iasAewXHkJ29Dg6sBBOJCTcscnazMJNMykWgZHj fHI8fO9IKjGkgQ+YWIoMvf3j1z9QhZvqfHGUdr+7gXOJ07iwzkzNHlkRSHnLPRS9v5/xy l1gY3yt5cgcW8OopteX06G9qrWMlUpHZ7mrl0KexFD7sQar7bo1/FVY8uIzpJtYIpYwUV SUJ204l05Is3hyGV5yL73MUVD/peKD4UIcZilSUnLsv9FXhaB65oyOwNo5KVyONq10g== 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=dV0dcJQr; 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 158AB606A333; Fri, 4 Dec 2026 10:43:40 +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=dV0dcJQr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80BA41F0093A; Fri, 4 Dec 2026 10:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381019; bh=bG/zBSoa0XxcCrY1IOAdmcaZVaQ6h1R0imgDicfFWHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dV0dcJQrN6Pv98HRlTECRcgEDru46H3f8EFu6hGAsWJ32C+p4UpyjpulEEHkM+iHJ 8vSVgoYU2KMs8rILx1GUjjBZ3w+9G3zHj0QszYN5uEbJgOjOQdXkxWA0X3Z6ijt6MX oBN0G6zW+TOQcbF0deILVvPfTYfHH3sY8dZkHErY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Ido Schimmel , Justin Iurman , Paolo Abeni Subject: [PATCH 7.3 522/742] ipv6: mcast: use skb_set_transport_header_careful() in ipv6_mc_check_exthdrs() Date: Fri, 4 Dec 2026 19:06:26 +0900 Message-ID: <20261204100649.036024598@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: stable@vger.kernel.org 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 425b1fe50b71628299d33faff28057e7fa4c60c7 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. ipv6_mc_check_exthdrs() stores the offset returned by ipv6_skip_exthdr(), which depends on the extension headers found in the packet. Should the value be truncated, ipv6_mc_check_icmpv6() and ipv6_mc_check_mld_msg() would then validate and parse the MLD message 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. No reproducer was written, this is hardening. Use skb_set_transport_header_careful() and treat such a packet as broken (-EINVAL). Fixes: 9afd85c9e455 ("net: Export IGMP/MLD message validation code") Cc: stable@vger.kernel.org Signed-off-by: Eric Dumazet Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20261113124625.4010206-3-edumazet@kernel.org Reviewed-by: Justin Iurman Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/ipv6/mcast_snoop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv6/mcast_snoop.c +++ b/net/ipv6/mcast_snoop.c @@ -56,7 +56,8 @@ static int ipv6_mc_check_exthdrs(struct if (nexthdr != IPPROTO_ICMPV6) return -ENOMSG; - skb_set_transport_header(skb, offset); + if (!skb_set_transport_header_careful(skb, offset)) + return -EINVAL; return 0; }