aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genetlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/genetlink.h')
-rw-r--r--include/linux/genetlink.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 61549b26ad6f..73c28dea10ae 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -85,6 +85,30 @@ enum {
85/* All generic netlink requests are serialized by a global lock. */ 85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void); 86extern void genl_lock(void);
87extern void genl_unlock(void); 87extern void genl_unlock(void);
88#ifdef CONFIG_PROVE_LOCKING
89extern int lockdep_genl_is_held(void);
90#endif
91
92/**
93 * rcu_dereference_genl - rcu_dereference with debug checking
94 * @p: The pointer to read, prior to dereferencing
95 *
96 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
97 * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
98 */
99#define rcu_dereference_genl(p) \
100 rcu_dereference_check(p, lockdep_genl_is_held())
101
102/**
103 * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
104 * @p: The pointer to read, prior to dereferencing
105 *
106 * Return the value of the specified RCU-protected pointer, but omit
107 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
108 * caller holds genl mutex.
109 */
110#define genl_dereference(p) \
111 rcu_dereference_protected(p, lockdep_genl_is_held())
88 112
89#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
90 114