Skip to content

Commit c91d829

Browse files
committed
netfilter: nf_tables: discard table flag update with pending basechain deletion
jira VULN-5118 cve CVE-2024-35897 commit-author Pablo Neira Ayuso <pablo@netfilter.org> commit 1bc83a0 Hook unregistration is deferred to the commit phase, same occurs with hook updates triggered by the table dormant flag. When both commands are combined, this results in deleting a basechain while leaving its hook still registered in the core. Fixes: 179d9ba ("netfilter: nf_tables: fix table flag updates") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit 1bc83a0) Signed-off-by: Greg Rose <g.v.rose@ciq.com>
1 parent bf62cab commit c91d829

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,11 @@ static bool nft_table_pending_update(const struct nft_ctx *ctx)
963963
return true;
964964

965965
list_for_each_entry(trans, &nft_net->commit_list, list) {
966-
if ((trans->msg_type == NFT_MSG_NEWCHAIN ||
967-
trans->msg_type == NFT_MSG_DELCHAIN) &&
968-
trans->ctx.table == ctx->table &&
969-
nft_trans_chain_update(trans))
966+
if (trans->ctx.table == ctx->table &&
967+
((trans->msg_type == NFT_MSG_NEWCHAIN &&
968+
nft_trans_chain_update(trans)) ||
969+
(trans->msg_type == NFT_MSG_DELCHAIN &&
970+
nft_is_base_chain(trans->ctx.chain))))
970971
return true;
971972
}
972973

0 commit comments

Comments
 (0)