netfilter: nf_tables: don't unregister hook when table is dormant
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v2 1/1 netfilter: nf_tables: don't unregister hook when table is dormant
From: Florian Westphal <[email protected]>
When nf_tables_updchain encounters an error, hook registration needs to be rolled back.
This should only be done if the hook has been registered, which won't happen when the table is flagged as dormant (inactive).
Just move the assignment into the registration block.
Reported-by [email protected]
Fixes b9703ed44ffb ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
Signed-off-by Florian Westphal <[email protected]>
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v2: toggle unregister flag only for netdev basechain.
net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +2 -2
@@ -2839,11 +2839,11 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, err =nft_netdev_register_hooks (ctx->net, &hook.list);if (err <0 ) goto err_hooks; + + unregister = true; } } - unregister = true; -if (nla[NFTA_CHAIN_COUNTERS ]) {if (!nft_is_base_chain (chain)) { err = -EOPNOTSUPP ;
Signature · 1 line
2.30.2