netfilter: ipset: Pass lockdep expression to RCU lists
authorAmol Grover <frextrite@gmail.com>
Sun, 16 Feb 2020 17:26:54 +0000 (22:56 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 6 Apr 2020 12:31:25 +0000 (14:31 +0200)
ip_set_type_list is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of ip_set_type_mutex.

Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.

Signed-off-by: Amol Grover <frextrite@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipset/ip_set_core.c

index 8dd1758..340cb95 100644 (file)
@@ -86,7 +86,8 @@ find_set_type(const char *name, u8 family, u8 revision)
 {
        struct ip_set_type *type;
 
-       list_for_each_entry_rcu(type, &ip_set_type_list, list)
+       list_for_each_entry_rcu(type, &ip_set_type_list, list,
+                               lockdep_is_held(&ip_set_type_mutex))
                if (STRNCMP(type->name, name) &&
                    (type->family == family ||
                     type->family == NFPROTO_UNSPEC) &&