From: Pablo Neira Ayuso Date: Tue, 6 Jun 2023 14:32:44 +0000 (+0200) Subject: netfilter: nf_tables: out-of-bound check in chain blob X-Git-Tag: microblaze-v6.6~340^2~15^2 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=08e42a0d3ad30f276f9597b591f975971a1b0fcf;p=linux-2.6-microblaze.git netfilter: nf_tables: out-of-bound check in chain blob 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 --- diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 3445b8e1f462..0519d45ede6b 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -9007,7 +9007,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);