[Devel] [PATCH RH7 2/3] ms/netfilter: Replace spin_is_locked() with lockdep

Vasily Averin vvs at virtuozzo.com
Sun Dec 6 08:56:04 MSK 2020


From: Lance Roy <ldr709 at gmail.com>

lockdep_assert_held() is better suited to checking locking requirements,
since it won't get confused when someone else holds the lock. This is
also a step towards possibly removing spin_is_locked().

Signed-off-by: Lance Roy <ldr709 at gmail.com>
Cc: Pablo Neira Ayuso <pablo at netfilter.org>
Cc: Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
Cc: Florian Westphal <fw at strlen.de>
Cc: "David S. Miller" <davem at davemloft.net>
Cc: <netfilter-devel at vger.kernel.org>
Cc: <coreteam at netfilter.org>
Cc: <netdev at vger.kernel.org>
Acked-by: Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

(cherry-picked from commit 4b87dd54be21ad611a1c740f9df0c4376d496e09)
https://jira.sw.ru/browse/PSBM-123086
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/netfilter/ipset/ip_set_hash_gen.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 225348a..a437adf 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -15,7 +15,7 @@
 
 #define __ipset_dereference_protected(p, c)	rcu_dereference_protected(p, c)
 #define ipset_dereference_protected(p, set) \
-	__ipset_dereference_protected(p, spin_is_locked(&(set)->lock))
+	__ipset_dereference_protected(p, lockdep_is_held(&(set)->lock))
 
 #define rcu_dereference_bh_nfnl(p)	rcu_dereference_bh_check(p, 1)
 
-- 
1.8.3.1



More information about the Devel mailing list