aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/key.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/key.h')
-rw-r--r--include/linux/key.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index cd50dfa1d4c2..6ea4eebd3467 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 * 10 *
11 * 11 *
12 * See Documentation/keys.txt for information on keys/keyrings. 12 * See Documentation/security/keys.txt for information on keys/keyrings.
13 */ 13 */
14 14
15#ifndef _LINUX_KEY_H 15#ifndef _LINUX_KEY_H
@@ -170,6 +170,7 @@ struct key {
170 struct list_head link; 170 struct list_head link;
171 unsigned long x[2]; 171 unsigned long x[2];
172 void *p[2]; 172 void *p[2];
173 int reject_error;
173 } type_data; 174 } type_data;
174 175
175 /* key data 176 /* key data
@@ -178,8 +179,9 @@ struct key {
178 */ 179 */
179 union { 180 union {
180 unsigned long value; 181 unsigned long value;
182 void __rcu *rcudata;
181 void *data; 183 void *data;
182 struct keyring_list *subscriptions; 184 struct keyring_list __rcu *subscriptions;
183 } payload; 185 } payload;
184}; 186};
185 187
@@ -274,6 +276,23 @@ static inline key_serial_t key_serial(struct key *key)
274 return key ? key->serial : 0; 276 return key ? key->serial : 0;
275} 277}
276 278
279/**
280 * key_is_instantiated - Determine if a key has been positively instantiated
281 * @key: The key to check.
282 *
283 * Return true if the specified key has been positively instantiated, false
284 * otherwise.
285 */
286static inline bool key_is_instantiated(const struct key *key)
287{
288 return test_bit(KEY_FLAG_INSTANTIATED, &key->flags) &&
289 !test_bit(KEY_FLAG_NEGATIVE, &key->flags);
290}
291
292#define rcu_dereference_key(KEY) \
293 (rcu_dereference_protected((KEY)->payload.rcudata, \
294 rwsem_is_locked(&((struct key *)(KEY))->sem)))
295
277#ifdef CONFIG_SYSCTL 296#ifdef CONFIG_SYSCTL
278extern ctl_table key_sysctls[]; 297extern ctl_table key_sysctls[];
279#endif 298#endif