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=1796382475; b=F/t7z2SlhGu7M9Y3JcE8IqTw8Zz1UsssuCJjpIpekHLyG8W4gN59dzgiHNSC3+49hsOn JUEN9hsqe2mrFZWqpCWEPeKIe2UYBJox9Zeq6uskbN2wlbrIjKM56T67U2IaTshpVFML0 tRABUoA5SWfkQQiq4bMDFwf4ziBX+PcuO98e44l3L911Dr0KAHmzp1QpxN7GnlCkTX7JP Z5DGRTh+GBafkEcESbRcc8JcMUs6Zf8QAFZ/bsMeafpsoOdD52CVmMTs8i1G0cGc9utgB UUasR7bryrPKb5OWHI3yD4Md30TvTT2VDp1OQ0h8bWgKkoR4QTZAjsy7YtfzEt4FBaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382475; 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=71M+eqziuTWgfsX07Pkc91l6L2X2HrxTnZ0LNS59gZs=; b=1OGN1eMMJJiheXu7+H9motbplEX7EmVqRo+3wSP7scL7vau5zCTeDiHpgKXy5uw9nhKj 0KEGm8Edh8a9hROhZ+KCfxVcPJYaAz3pu2cmCCRmJyNTwGZTIu6oWFJZYvyr9KVig6xPb yfibCk3C+2AJ3PvM3sOzSyQtILZQFOf5cYcKDckEKmkWj7XFqtDFC+6Q+ccVvk8tWPqj6 SDNF7BYy2T5Tx6sp8eCYCMXQmepGC3AIMWVim3AaBqiKwH9+xxt6IvxF1CCWrP2ysPPoP UIZya7/s9OM0iKNairX2I6DSlMp0lHUmwVoJCD3Dl+txH0C4RSC/rl8qVNtwyEtCnlQ== 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=VxNqK1YW; 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 EBE2A606A68C; Fri, 4 Dec 2026 11:07: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=VxNqK1YW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B8DD1F00933; Fri, 4 Dec 2026 11:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382474; bh=71M+eqziuTWgfsX07Pkc91l6L2X2HrxTnZ0LNS59gZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VxNqK1YWgzNuECTGbVpk1RfkqA9bTIb4N82BdXPpez8CGhU/RnUpewzcpIbPC92xU 1mY/y1SYqwOT3cpcaIJ6X0zlyMJluTtJ3YJQ8WRBWRcDyiKhgkWC8AVuES1fcO6fI8 AyjsR2TqmTeDd/ajQe8RSLTXdUEQXyYRVnOhmNGc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hyunwoo Kim , Eric Dumazet , Daniel Borkmann , David Ahern , Ido Schimmel , Aaron Conole , Justin Iurman , Paolo Abeni Subject: [PATCH 6.18 470/703] ipv6: gro: limit the number of extension headers Date: Fri, 4 Dec 2026 19:06:09 +0900 Message-ID: <20261204100640.299489016@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 050f2adb60434a2b4dee2cf3350269379a32cf72 upstream. Hyunwoo Kim reported that a long chain of IPv6 extension headers can push the transport header offset of a GRO packet beyond what the 16-bit skb->transport_header can store. The truncated offset is later used by gro_receive_network_flush() to locate the network header of a packet held in the GRO list, leading to an out-of-bounds read. Since commit 3744b0964d52 ("ipv6: Implement limits on extension header parsing"), ip6_protocol_deliver_rcu() drops packets carrying more than IP6_MAX_EXT_HDRS_CNT extension headers, but ipv6_gro_pull_exthdrs() was left unbounded. There is no point trying to aggregate packets that the stack is going to drop anyway if they are locally delivered. Apply the same limit in ipv6_gro_pull_exthdrs(). When the limit is hit, @proto still designates an extension header. Extension header offloads have no gro_receive() callback, so ipv6_gro_receive() takes its existing "goto out" path with flush set, and the packet is given to the normal receive path. Local delivery drops it with SKB_DROP_REASON_IPV6_TOO_MANY_EXTHDRS, while forwarded packets are simply not aggregated. An extension header being at most 2048 bytes, this bounds a chain to 24576 bytes. Note that offsets can still accumulate over nested encapsulations, so the places storing them should be hardened separately. Fixes: 4b0ebbca3e16 ("net: gro: move L3 flush checks to tcp_gro_receive and udp_gro_receive_segment") Cc: stable@vger.kernel.org Reported-by: Hyunwoo Kim Link: https://lore.kernel.org/netdev/avTTQNyvwPP6LtGx@v4bel/ Signed-off-by: Eric Dumazet Cc: Daniel Borkmann Cc: David Ahern Cc: Ido Schimmel Tested-by: Hyunwoo Kim Reviewed-by: Ido Schimmel Reviewed-by: Aaron Conole Link: https://patch.msgid.link/20261113124625.4010206-2-edumazet@kernel.org Reviewed-by: Justin Iurman Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_offload.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -42,6 +42,7 @@ static int ipv6_gro_pull_exthdrs(struct { const struct net_offload *ops = NULL; struct ipv6_opt_hdr *opth; + int exthdr_cnt = 0; for (;;) { int len; @@ -54,6 +55,13 @@ static int ipv6_gro_pull_exthdrs(struct if (!(ops->flags & INET6_PROTO_GSO_EXTHDR)) break; + /* Same limit as ip6_protocol_deliver_rcu(). + * @proto is left pointing to an extension header, + * so that the caller does not aggregate this packet. + */ + if (unlikely(exthdr_cnt++ >= IP6_MAX_EXT_HDRS_CNT)) + break; + opth = skb_gro_header(skb, off + sizeof(*opth), off); if (unlikely(!opth)) break;