]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: nf_tables: always initialize flowtable hook list in transaction
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 1 Jun 2022 15:49:36 +0000 (17:49 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 2 Jun 2022 21:31:11 +0000 (23:31 +0200)
The hook list is used if nft_trans_flowtable_update(trans) == true. However,
initialize this list for other cases for safety reasons.

Fixes: 78d9f48f7f44 ("netfilter: nf_tables: add devices to existing flowtable")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 30588349f96c20cf632f0d70144ed8cfc31ca301..2faa77cd2fe250741cf3ce5a7264ac0715d48233 100644 (file)
@@ -544,6 +544,7 @@ static int nft_trans_flowtable_add(struct nft_ctx *ctx, int msg_type,
        if (msg_type == NFT_MSG_NEWFLOWTABLE)
                nft_activate_next(ctx->net, flowtable);
 
+       INIT_LIST_HEAD(&nft_trans_flowtable_hooks(trans));
        nft_trans_flowtable(trans) = flowtable;
        nft_trans_commit_list_add_tail(ctx->net, trans);