diff options
Diffstat (limited to 'security/keys/permission.c')
-rw-r--r-- | security/keys/permission.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/security/keys/permission.c b/security/keys/permission.c index 5d9fc7b93f2e..0ed802c9e698 100644 --- a/security/keys/permission.c +++ b/security/keys/permission.c | |||
@@ -35,6 +35,9 @@ int key_task_permission(const key_ref_t key_ref, const struct cred *cred, | |||
35 | 35 | ||
36 | key = key_ref_to_ptr(key_ref); | 36 | key = key_ref_to_ptr(key_ref); |
37 | 37 | ||
38 | if (key->user->user_ns != cred->user->user_ns) | ||
39 | goto use_other_perms; | ||
40 | |||
38 | /* use the second 8-bits of permissions for keys the caller owns */ | 41 | /* use the second 8-bits of permissions for keys the caller owns */ |
39 | if (key->uid == cred->fsuid) { | 42 | if (key->uid == cred->fsuid) { |
40 | kperm = key->perm >> 16; | 43 | kperm = key->perm >> 16; |
@@ -56,6 +59,8 @@ int key_task_permission(const key_ref_t key_ref, const struct cred *cred, | |||
56 | } | 59 | } |
57 | } | 60 | } |
58 | 61 | ||
62 | use_other_perms: | ||
63 | |||
59 | /* otherwise use the least-significant 8-bits */ | 64 | /* otherwise use the least-significant 8-bits */ |
60 | kperm = key->perm; | 65 | kperm = key->perm; |
61 | 66 | ||