]> git.itanic.dy.fi Git - linux-stable/commitdiff
netfilter: nf_tables: set dormant flag on hook register failure
authorFlorian Westphal <fw@strlen.de>
Mon, 19 Feb 2024 15:58:04 +0000 (16:58 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 21 Feb 2024 23:14:54 +0000 (00:14 +0100)
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

index f8e3f70c35bd558aec8a2b2149a7ff7db0eb3d1f..90038d778f373f17d94230604b6e9c5783c385ab 100644 (file)
@@ -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;
 }