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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/security/keys/permission.c b/security/keys/permission.c
index 1c3651670ce9..03db073ba45c 100644
--- a/security/keys/permission.c
+++ b/security/keys/permission.c
@@ -27,12 +27,6 @@ int key_task_permission(const key_ref_t key_ref,
27 27
28 key = key_ref_to_ptr(key_ref); 28 key = key_ref_to_ptr(key_ref);
29 29
30 /* use the top 8-bits of permissions for keys the caller possesses */
31 if (is_key_possessed(key_ref)) {
32 kperm = key->perm >> 24;
33 goto use_these_perms;
34 }
35
36 /* use the second 8-bits of permissions for keys the caller owns */ 30 /* use the second 8-bits of permissions for keys the caller owns */
37 if (key->uid == context->fsuid) { 31 if (key->uid == context->fsuid) {
38 kperm = key->perm >> 16; 32 kperm = key->perm >> 16;
@@ -61,6 +55,12 @@ int key_task_permission(const key_ref_t key_ref,
61 kperm = key->perm; 55 kperm = key->perm;
62 56
63use_these_perms: 57use_these_perms:
58 /* use the top 8-bits of permissions for keys the caller possesses
59 * - possessor permissions are additive with other permissions
60 */
61 if (is_key_possessed(key_ref))
62 kperm |= key->perm >> 24;
63
64 kperm = kperm & perm & KEY_ALL; 64 kperm = kperm & perm & KEY_ALL;
65 65
66 return kperm == perm; 66 return kperm == perm;