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 D1683134A4 for ; Mon, 12 Jun 2023 10:47:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 590EEC433EF; Mon, 12 Jun 2023 10:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686566824; bh=4OOyBHjU/8yCIJRyUNPLnZyy0CTpJxNaf7Yi/zNAzeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iPAkfbL2MjlRCHCES7527ScquG8fcB0bFIABmatMg9VJ+KyndizgZyQoXWF7LDhnj fEGxyLQYSC8ncZK1BaDCtB0BPAFmNwzkm3W62CSt8sLq4qjq8jkEIOp3/XoZK/ckUi RngOviPpSqbgVkB/Sxan5BrI0P1x6v7Nt/Q+lCP0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.3 045/160] netfilter: nf_tables: out-of-bound check in chain blob Date: Mon, 12 Jun 2023 12:26:17 +0200 Message-ID: <20230612101717.101433202@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612101715.129581706@linuxfoundation.org> References: <20230612101715.129581706@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Pablo Neira Ayuso [ Upstream commit 08e42a0d3ad30f276f9597b591f975971a1b0fcf ] Add current size of rule expressions to the boundary check. Fixes: 2c865a8a28a1 ("netfilter: nf_tables: add rule blob layout") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 8c74bb1ca78a0..368aeabd8f8f1 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -8921,7 +8921,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha continue; } - if (WARN_ON_ONCE(data + expr->ops->size > data_boundary)) + if (WARN_ON_ONCE(data + size + expr->ops->size > data_boundary)) return -ENOMEM; memcpy(data + size, expr, expr->ops->size); -- 2.39.2