]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: nf_tables: use correct lock to protect gc_list
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 21 Aug 2023 12:33:32 +0000 (14:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 12:52:33 +0000 (14:52 +0200)
[ Upstream commit 8357bc946a2abc2a10ca40e5a2105d2b4c57515e ]

Use nf_tables_gc_list_lock spinlock, not nf_tables_destroy_list_lock to
protect the gc list.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c

index 9cd8c14a0faf4405a5569eb6a30f6819b51ad096..ad38f84a8f11ad02b53e77ec0b630746d89bd687 100644 (file)
@@ -9470,9 +9470,9 @@ static void nft_trans_gc_work(struct work_struct *work)
        struct nft_trans_gc *trans, *next;
        LIST_HEAD(trans_gc_list);
 
-       spin_lock(&nf_tables_destroy_list_lock);
+       spin_lock(&nf_tables_gc_list_lock);
        list_splice_init(&nf_tables_gc_list, &trans_gc_list);
-       spin_unlock(&nf_tables_destroy_list_lock);
+       spin_unlock(&nf_tables_gc_list_lock);
 
        list_for_each_entry_safe(trans, next, &trans_gc_list, list) {
                list_del(&trans->list);