Skip to content

Commit feb1fa2

Browse files
Florian Westphalgregkh
authored andcommitted
netfilter: nf_tables: don't unregister hook when table is dormant
[ Upstream commit 688c150 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 86bd960 commit feb1fa2

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
@@ -2732,11 +2732,11 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
27322732
err = nft_netdev_register_hooks(ctx->net, &hook.list);
27332733
if (err < 0)
27342734
goto err_hooks;
2735+
2736+
unregister = true;
27352737
}
27362738
}
27372739

2738-
unregister = true;
2739-
27402740
if (nla[NFTA_CHAIN_COUNTERS]) {
27412741
if (!nft_is_base_chain(chain)) {
27422742
err = -EOPNOTSUPP;

0 commit comments

Comments
 (0)