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=1796383889; b=eXhSWLL3Q93RvUVyJ6yoOHs+/pirIozL+MwdbpG1sN0J9VTuZJ1+r8hlI108LZUNlCSr x7mkX9P+oBU3+pzNujKTfGG08BV2Q/gYK6wmHbLJIVqq3Ag9hRQ8Tzn6Q22GugXFKAxTc 0EODX0Z4fgeW2Fj4MyZasjFput4vKNv8xWJWOPehNaJUvRUrm+ght6epd2COPg5rC9RH/ yw9c7oX8L+905pF31pEYjLequ2wpLDX3sbFS6C+kEwKgt06/EjSp/Ht+jSGxBPL9tG5lR N+coULRE1N2O2IsDgQUwjthwxDlR0F6L6ypR4sTkGndysK3sgk2BrZULOO0kJ0PjWOw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383889; 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=CGuzvafnr8Psxf33Umri4djIl8l8XZQsXXtj1Fhv0WY=; b=YpzAoeAj6q6yaMLBAJW2Q8QzLVcjuXxgIX9Evs3bhDl70Fquafc9WpYdyY9eK3QtMry0 G813fszpIB2IBC3KUzlPIdnIFPiXFcx7jMGKkkm0GuexV1qvRqmubI3y0CfT0iqBXz79s ZXswqiqY5tBKnoDph01BHZj95RwZSNPnT5aDBJwNn1E0FIqw3W96uapop/PxgOVICKKXH bzBUc5fPQqm4rrgIrQ03ofJ3DAj/Ntrenk9qmZmzQER4EWB3/UvRMEo+4bx4NJ7ff5fhw GttIuNLDQoy8H3ajsRVZu5VWM6QZt1N+90ObofXV/bcJ4lklHUytFUKHzO3lNCVmzqA== 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=ljuBM5Ko; 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 70AC3606A32C; Fri, 4 Dec 2026 11:31:29 +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=ljuBM5Ko Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B3D1F00A0E; Fri, 4 Dec 2026 11:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383889; bh=CGuzvafnr8Psxf33Umri4djIl8l8XZQsXXtj1Fhv0WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ljuBM5KoebV5AJF6XDWDaFMjRoLYUsIYK3HFq3qF3vLyHgwL89rqMGBFeuoO3c2B/ 25L6scZmNBjV5Fy0XplKDV86+Sx9/+Uh9iAOJq1wLKJPDwm0BoX88HrJ3Ttn6lZ05e kYSvC5rs0cbzg97SZXeSelLh3RpKhtS/HZnqlMMA= 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 6.12 409/555] ipv6: mcast: use skb_set_transport_header_careful() in ipv6_mc_check_exthdrs() Date: Fri, 4 Dec 2026 19:07:32 +0900 Message-ID: <20261204100625.313900896@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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; }