Skip to contentSkip to conversation

netfilter: ipset: use nfnl_mutex_is_locked

PATCH Applied Florian Westphal 3 participants 3 messages Nov 30, 2017 – Dec 6, 2017

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: ipset: use nfnl_mutex_is_locked

Check that we really hold nfnl mutex here instead of relying on correct usage alone.

---

net/netfilter/ipset/ip_set_core.c +1 -1
index d5a43cad90f04..1f3c03b3bebf2 100644
@@ -57,7 +57,7 @@ MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
 
 /* When the nfnl mutex is held: */
 #define ip_set_dereference(p)		\
-	rcu_dereference_protected(p, 1)
+	rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
 #define ip_set(inst, id)		\
 	ip_set_dereference((inst)->ip_set_list)[id]
 
Signature · 1 line
2.14.3
Acked-by on v1 1/1
#1 lore raw

Hi Florian,

Quoted 4 lines · Florian Westphal

Check that we really hold nfnl mutex here instead of relying on correct usage alone.

Yes, it's better this way :-)

Quoted 22 lines

---

net/netfilter/ipset/ip_set_core.c +1 -1
index d5a43cad90f04..1f3c03b3bebf2 100644
@@ -57,7 +57,7 @@ MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
 
 /* When the nfnl mutex is held: */
 #define ip_set_dereference(p)		\
-	rcu_dereference_protected(p, 1)
+	rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
 #define ip_set(inst, id)		\
 	ip_set_dereference((inst)->ip_set_list)[id]
 
Signature · 6 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary