KEYS: Add an RCU payload dereference macro
[linux-3.10.git] / include / linux / key.h
index 3db0adc..a6b1edc 100644 (file)
@@ -275,6 +275,10 @@ static inline key_serial_t key_serial(struct key *key)
        return key ? key->serial : 0;
 }
 
+#define rcu_dereference_key(KEY)                                       \
+       (rcu_dereference_protected((KEY)->payload.rcudata,              \
+                                  rwsem_is_locked(&((struct key *)(KEY))->sem)))
+
 #ifdef CONFIG_SYSCTL
 extern ctl_table key_sysctls[];
 #endif