netfilter: nf_tables: skip set commit for deleted/destroyed sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 19 Dec 2023 18:44:49 +0000 (19:44 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 20 Dec 2023 12:48:00 +0000 (13:48 +0100)
NFT_MSG_DELSET deactivates all elements in the set, skip
set->ops->commit() to avoid the unnecessary clone (for the pipapo case)
as well as the sync GC cycle, which could deactivate again expired
elements in such set.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Reported-by: Kevin Rich <kevinrich1337@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index c5c17c6e80eda1f5a33e035a427ee4b2be2f786f..be04af433988da324b949c9b7e96c358a1526a40 100644 (file)
@@ -9887,7 +9887,7 @@ static void nft_set_commit_update(struct list_head *set_update_list)
        list_for_each_entry_safe(set, next, set_update_list, pending_update) {
                list_del_init(&set->pending_update);
 
-               if (!set->ops->commit)
+               if (!set->ops->commit || set->dead)
                        continue;
 
                set->ops->commit(set);