summaryrefslogtreecommitdiffstats
path: root/kernel/net
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-10-30 22:30:30 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-10-30 22:30:30 +0100
commit7d6e460d9373bc8614b7e33da5b720503d803cb5 (patch)
tree786cef32acce632f012fe39726d55fed14345234 /kernel/net
parentbe7bb9cd70de48c2076c20d2a03b9a8c5388bff7 (diff)
Correct workaround in patch "Fix calling ip_set() macro at dumping"
As Pablo pointed out, in order to fix the bogus warnings, there's no need for the non-useful rcu_read_lock/unlock dancing. Call rcu_dereference_raw() instead, the ref_netlink protects the set.
Diffstat (limited to 'kernel/net')
-rw-r--r--kernel/net/netfilter/ipset/ip_set_core.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/kernel/net/netfilter/ipset/ip_set_core.c b/kernel/net/netfilter/ipset/ip_set_core.c
index e99dda9..c2e32ee 100644
--- a/kernel/net/netfilter/ipset/ip_set_core.c
+++ b/kernel/net/netfilter/ipset/ip_set_core.c
@@ -62,19 +62,8 @@ MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
lockdep_is_held(&ip_set_ref_lock))
#define ip_set(inst, id) \
ip_set_dereference((inst)->ip_set_list)[id]
-
-/* When the nfnl mutex is not held (dumping): */
-static inline
-struct ip_set * ip_set_no_mutex(struct ip_set_net *inst, ip_set_id_t id)
-{
- struct ip_set *set;
-
- rcu_read_lock();
- set = rcu_dereference((inst)->ip_set_list)[id];
- rcu_read_unlock();
-
- return set;
-}
+#define ip_set_ref_netlink(inst,id) \
+ rcu_dereference_raw((inst)->ip_set_list)[id]
/* The set types are implemented in modules and registered set types
* can be found in ip_set_type_list. Adding/deleting types is
@@ -1283,7 +1272,7 @@ ip_set_dump_done(struct netlink_callback *cb)
struct ip_set_net *inst =
(struct ip_set_net *)cb->args[IPSET_CB_NET];
ip_set_id_t index = (ip_set_id_t)cb->args[IPSET_CB_INDEX];
- struct ip_set *set = ip_set_no_mutex(inst, index);
+ struct ip_set *set = ip_set_ref_netlink(inst, index);
if (set->variant->uref)
set->variant->uref(set, cb, false);
@@ -1477,7 +1466,7 @@ next_set:
release_refcount:
/* If there was an error or set is done, release set */
if (ret || !cb->args[IPSET_CB_ARG0]) {
- set = ip_set_no_mutex(inst, index);
+ set = ip_set_ref_netlink(inst, index);
if (set->variant->uref)
set->variant->uref(set, cb, false);
pr_debug("release set %s\n", set->name);