Skip to content

Commit 688c150

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: don't unregister hook when table is dormant
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: syzbot+53ed3a6440173ddbf499@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=53ed3a6440173ddbf499 Fixes: b9703ed ("netfilter: nf_tables: support for adding new devices to an existing netdev chain") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 9d74da1 commit 688c150

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,11 +2839,11 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
28392839
err = nft_netdev_register_hooks(ctx->net, &hook.list);
28402840
if (err < 0)
28412841
goto err_hooks;
2842+
2843+
unregister = true;
28422844
}
28432845
}
28442846

2845-
unregister = true;
2846-
28472847
if (nla[NFTA_CHAIN_COUNTERS]) {
28482848
if (!nft_is_base_chain(chain)) {
28492849
err = -EOPNOTSUPP;

0 commit comments

Comments
 (0)