aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/permission.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/permission.c')
-rw-r--r--security/keys/permission.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/security/keys/permission.c b/security/keys/permission.c
index 6284b1496c29..c35b5229e3cd 100644
--- a/security/keys/permission.c
+++ b/security/keys/permission.c
@@ -1,4 +1,4 @@
1/* permission.c: key permission determination 1/* Key permission checking
2 * 2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -15,15 +15,17 @@
15 15
16/** 16/**
17 * key_task_permission - Check a key can be used 17 * key_task_permission - Check a key can be used
18 * @key_ref: The key to check 18 * @key_ref: The key to check.
19 * @cred: The credentials to use 19 * @cred: The credentials to use.
20 * @perm: The permissions to check for 20 * @perm: The permissions to check for.
21 * 21 *
22 * Check to see whether permission is granted to use a key in the desired way, 22 * Check to see whether permission is granted to use a key in the desired way,
23 * but permit the security modules to override. 23 * but permit the security modules to override.
24 * 24 *
25 * The caller must hold either a ref on cred or must hold the RCU readlock or a 25 * The caller must hold either a ref on cred or must hold the RCU readlock.
26 * spinlock. 26 *
27 * Returns 0 if successful, -EACCES if access is denied based on the
28 * permissions bits or the LSM check.
27 */ 29 */
28int key_task_permission(const key_ref_t key_ref, const struct cred *cred, 30int key_task_permission(const key_ref_t key_ref, const struct cred *cred,
29 key_perm_t perm) 31 key_perm_t perm)
@@ -79,11 +81,15 @@ use_these_perms:
79 /* let LSM be the final arbiter */ 81 /* let LSM be the final arbiter */
80 return security_key_permission(key_ref, cred, perm); 82 return security_key_permission(key_ref, cred, perm);
81} 83}
82
83EXPORT_SYMBOL(key_task_permission); 84EXPORT_SYMBOL(key_task_permission);
84 85
85/* 86/**
86 * validate a key 87 * key_validate - Validate a key.
88 * @key: The key to be validated.
89 *
90 * Check that a key is valid, returning 0 if the key is okay, -EKEYREVOKED if
91 * the key's type has been removed or if the key has been revoked or
92 * -EKEYEXPIRED if the key has expired.
87 */ 93 */
88int key_validate(struct key *key) 94int key_validate(struct key *key)
89{ 95{
@@ -109,5 +115,4 @@ int key_validate(struct key *key)
109error: 115error:
110 return ret; 116 return ret;
111} 117}
112
113EXPORT_SYMBOL(key_validate); 118EXPORT_SYMBOL(key_validate);