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 C0749305064; Mon, 13 Apr 2026 16:33:55 +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=1776098035; cv=none; b=CriJS6oDitQbeut3VeAqm7qrICtcAk1Bo0ncmj9ahAUR1M+0WH4tzx7cyZ9Ug2dnFvuVbnv5BZcnlkaXQ3dwDfpjxuERLBQplAIH5Jvmypqzo3udPEkpxxveFFerT0o8fCZGLl/wJ5OimputXbZntX1wF5mCiIBnKWA+ev0+HuI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098035; c=relaxed/simple; bh=hvsojj997Rco+QwB3kxTqU0gPJjxpOgJiVKAbmrqNtM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZMlgWESaGtQ06W2wzxELo9kiKQkKHmiXDpVcuFcUtqWs8hsTL9ywdmSf+AhOjldPKYcWHvzodXtyYRlBk61ve93b6deOTD9gPjoFNL9qWltEja0i1rtI9GoMWINhzXxslutWHAcCh74o+1jYGf1YYat2ttKdYcc8OUZzWFj05GI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qpVMZzz8; 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="qpVMZzz8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2F5CC2BCAF; Mon, 13 Apr 2026 16:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776098035; bh=hvsojj997Rco+QwB3kxTqU0gPJjxpOgJiVKAbmrqNtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpVMZzz88RK78BziTOPABxuU6oDbQJt7BLJRUOFPW0/1emXYdEL78ytSymV8HfUKZ hwmXqWz2Dx6N3cdteOjKyezIY/rAA4nfin8mePZV43XelowW1oaX9qm4fDa/Y6auWG IvYY4kmv3Tqdh1xCdlDrjjhZrlRaiTUN6kUpj3/g= 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 5.15 335/570] netfilter: ip6t_rt: reject oversized addrnr in rt_mt6_check() Date: Mon, 13 Apr 2026 17:57:46 +0200 Message-ID: <20260413155843.042785254@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155830.386096114@linuxfoundation.org> References: <20260413155830.386096114@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-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