From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC00E3FA5D9; Tue, 31 Mar 2026 16:37:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975039; cv=none; b=JTBvxKrrzBMnjyBsfU6mhiiTkb+l8y2xaMt9j7S0OjyKb7cbDPqPC9UET5/QsVTCRrh8NRfYwQEZ1iSS3Fy3I473BuNZEEAOajaI/MMRE7QyP8StK4Ogx7nSEPRDprRrctr2JCsPlFJFgPLA+DnuMFmZFiKUWJ0+Rp+VUxTjYCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975039; c=relaxed/simple; bh=zLKNNLw0FYdMxWEnQ/lz50BQYj1pAFnJ6XHh/8H8Bqg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V9+EjJYdOcnl3pvdbwVQgAIMQwKka8rqeJz7A71oW5WTPatqMrtAaDyEsQkIcyJ1k2crUte3Li9PmlDdfyqz1oI6Po1NCbHJczxpE4fhNz3CV70LqPjkGnT+GTWOkGyViu9dhxMzwbxaXiHGoYGItHbVwYA3K7+9FV/VhWh1+Ms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mC+4WD+k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mC+4WD+k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CBE9C19423; Tue, 31 Mar 2026 16:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774975039; bh=zLKNNLw0FYdMxWEnQ/lz50BQYj1pAFnJ6XHh/8H8Bqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mC+4WD+kWyyYpIf0k9m4T6VENGqlerhS8/jzgfgK9xSJKjK9JhUSCTMAGjr1lKNT+ pXqxiROwrC6CDK2VWMakSWvRUi/jKnIlxstk+HIPYFwTc1yiq1VVxW+KW3NvkGWAhT w5xjlW8KK4SeJyJRrpxef22CkNJo7gmVROEzrETM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Yuhang Zheng , Ren Wei , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.19 141/342] netfilter: ip6t_rt: reject oversized addrnr in rt_mt6_check() Date: Tue, 31 Mar 2026 18:19:34 +0200 Message-ID: <20260331161804.196336953@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161758.909578033@linuxfoundation.org> References: <20260331161758.909578033@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ren Wei [ Upstream commit 9d3f027327c2fa265f7f85ead41294792c3296ed ] Reject rt match rules whose addrnr exceeds IP6T_RT_HOPS. rt_mt6() expects addrnr to stay within the bounds of rtinfo->addrs[]. Validate addrnr during rule installation so malformed rules are rejected before the match logic can use an out-of-range value. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Yifan Wu Reported-by: Juefei Pu Co-developed-by: Yuan Tan Signed-off-by: Yuan Tan Suggested-by: Xin Liu Tested-by: Yuhang Zheng Signed-off-by: Ren Wei Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/ipv6/netfilter/ip6t_rt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 4ad8b2032f1f9..5561bd9cea818 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c @@ -157,6 +157,10 @@ static int rt_mt6_check(const struct xt_mtchk_param *par) pr_debug("unknown flags %X\n", rtinfo->invflags); return -EINVAL; } + if (rtinfo->addrnr > IP6T_RT_HOPS) { + pr_debug("too many addresses specified\n"); + return -EINVAL; + } if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) && (!(rtinfo->flags & IP6T_RT_TYP) || (rtinfo->rt_type != 0) || -- 2.51.0