]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Missing nfnl_lock()/nfnl_unlock() is added to ip_set_net_exit()
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 4 Jan 2018 13:15:22 +0000 (14:15 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 4 Jan 2018 13:15:22 +0000 (14:15 +0100)
Patch "netfilter: ipset: use nfnl_mutex_is_locked" is added the real
mutex locking check, which revealed the missing locking in ip_set_net_exit().

kernel/net/netfilter/ipset/ip_set_core.c

index 6fbbaeaa77e61ec263757781cfaf5491f65e9131..31704e8301a9996a36b9689a590043d195d6e517 100644 (file)
@@ -2130,6 +2130,7 @@ ip_set_net_exit(struct net *net)
 
        inst->is_deleted = true; /* flag for ip_set_nfnl_put */
 
+       nfnl_lock(NFNL_SUBSYS_IPSET);
        for (i = 0; i < inst->ip_set_max; i++) {
                set = ip_set(inst, i);
                if (set) {
@@ -2137,6 +2138,7 @@ ip_set_net_exit(struct net *net)
                        ip_set_destroy_set(set);
                }
        }
+       nfnl_unlock(NFNL_SUBSYS_IPSET);
        kfree(rcu_dereference_protected(inst->ip_set_list, 1));
 #ifndef HAVE_NET_OPS_ID
        kfree(inst);