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=1796381017; b=do8x+vnj44eDKLh07OMArmnMIlvsA8xekhMCJhV7otX3B4+zS6IAZ5hBijOvI+gK6oWb GvkFUV3vxIt6jHYShDEPpJzxPpNxfUYQDJQEuFxknROi/Wmq5OYhDz87CDGHDgVlYfSwD Vu4zHeY2kZPSBt7JBa39StSvyvSMOjJ7JXqPyEmhKtErsI43UR8nwoRts1NycVru+4TOV SPG5V2vtGlRkMPkTNRm2kuf/HiOZMkYwdSXiNjSRs4IlNDjZPHi49Gf/0B1kIM9ifrvrf /5lTAqVfzVn4PRGedmZVc1Y5OUGzo7BaTlYwSa1H1A4MMLtJqFIz7CmWMP0inYmGLDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381017; 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=NLSvFdESCmO8SGRYYsyqF9z9tdufkH8FoNGi+eb+UA0=; b=rDfwhIoSSwnAtyC+m8OhJN+rIoRweDABc/nwnVrSLaA8m1Y5CECRAuH8SlwvijtpEiAp ToXBM/z8LTsIwi68SE+uz7tWwPKskMIpV0E9H5nuKA9m7SDMJDc58r+Y325Ao/rjO9VCJ FdARXsHrDCg+dGBKD4wdEC1uXlHRpc1/XLGmoVaCpPMHNZMbqU3ZqFDGB715/wgq9TPKl WXUHmy9WUWsAMkc7quFxEfLNZqteIDzKjN/rIPVnDncI+dGfMrx1eqhLvDPduHUiVw+YX vJeijFjxD9IVxraVwmDJ91v6aJDmw0GbYXJpEcmCg8EMU1B/zLN5vaKV8o0rnC/41Eg== 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=sUnSiNT0; 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 B7097606A33F; Fri, 4 Dec 2026 10:43:37 +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=sUnSiNT0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 328121F00936; Fri, 4 Dec 2026 10:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381017; bh=NLSvFdESCmO8SGRYYsyqF9z9tdufkH8FoNGi+eb+UA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sUnSiNT0wTYaMrAAtvQnJyhWGi4yntbmEqENTH+q5MsEtZcZn8ddSjPYrxOo1oaNd WoZfX0gjFNlEItaITt5muzE/DEQ97rJ3C3E1otTHEuhhLAg4AjmWqgyt4yrvVpJHNC 91G0ZOA61JY4wUVOBOROFQdByncWnBKt5aJi9nIw= 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 7.3 521/742] ipv6: gro: limit the number of extension headers Date: Fri, 4 Dec 2026 19:06:25 +0900 Message-ID: <20261204100649.008134549@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 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 @@ -26,6 +26,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; @@ -38,6 +39,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;