diff mbox series

[net,1/5] netfilter: nf_tables: set dormant flag on hook register failure

Message ID 20240222000843.146665-2-pablo@netfilter.org (mailing list archive)
State Accepted
Commit bccebf64701735533c8db37773eeacc6566cc8ec
Delegated to: Netdev Maintainers
Headers show
Series [net,1/5] netfilter: nf_tables: set dormant flag on hook register failure | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 972 this patch: 972
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: coreteam@netfilter.org kadlec@netfilter.org
netdev/build_clang success Errors and warnings before: 973 this patch: 973
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 989 this patch: 989
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-22--09-00 (tests: 1450)

Commit Message

Pablo Neira Ayuso Feb. 22, 2024, 12:08 a.m. UTC
From: Florian Westphal <fw@strlen.de>

We need to set the dormant flag again if we fail to register
the hooks.

During memory pressure hook registration can fail and we end up
with a table marked as active but no registered hooks.

On table/base chain deletion, nf_tables will attempt to unregister
the hook again which yields a warn splat from the nftables core.

Reported-and-tested-by: syzbot+de4025c006ec68ac56fc@syzkaller.appspotmail.com
Fixes: 179d9ba5559a ("netfilter: nf_tables: fix table flag updates")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 22, 2024, 9:30 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <pablo@netfilter.org>:

On Thu, 22 Feb 2024 01:08:39 +0100 you wrote:
> From: Florian Westphal <fw@strlen.de>
> 
> We need to set the dormant flag again if we fail to register
> the hooks.
> 
> During memory pressure hook registration can fail and we end up
> with a table marked as active but no registered hooks.
> 
> [...]

Here is the summary with links:
  - [net,1/5] netfilter: nf_tables: set dormant flag on hook register failure
    https://git.kernel.org/netdev/net/c/bccebf647017
  - [net,2/5] netfilter: nft_flow_offload: reset dst in route object after setting up flow
    https://git.kernel.org/netdev/net/c/9e0f0430389b
  - [net,3/5] netfilter: nft_flow_offload: release dst in case direct xmit path is used
    https://git.kernel.org/netdev/net/c/8762785f459b
  - [net,4/5] netfilter: nf_tables: register hooks last when adding new chain/flowtable
    https://git.kernel.org/netdev/net/c/d472e9853d7b
  - [net,5/5] netfilter: nf_tables: use kzalloc for hook allocation
    https://git.kernel.org/netdev/net/c/195e5f88c2e4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f8e3f70c35bd..90038d778f37 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1251,6 +1251,7 @@  static int nf_tables_updtable(struct nft_ctx *ctx)
 	return 0;
 
 err_register_hooks:
+	ctx->table->flags |= NFT_TABLE_F_DORMANT;
 	nft_trans_destroy(trans);
 	return ret;
 }