aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack/smack_lsm.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2014-04-13 21:42:49 -0400
committerJames Morris <james.l.morris@oracle.com>2014-04-13 21:42:49 -0400
commitb13cebe70775e67323e1c2eff20e1cd174e430a4 (patch)
tree80e5775c2ce5c90bdef8a2ce487fb70a179217af /security/smack/smack_lsm.c
parentecd740c6f2f092b90b95fa35f757973589eaaca2 (diff)
parentfffea214abf66a8672cfd6697fae65e743e22f11 (diff)
Merge tag 'keys-20140314' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r--security/smack/smack_lsm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 14f52be78c75..8177e7df8c2d 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3506,11 +3506,12 @@ static void smack_key_free(struct key *key)
3506 * an error code otherwise 3506 * an error code otherwise
3507 */ 3507 */
3508static int smack_key_permission(key_ref_t key_ref, 3508static int smack_key_permission(key_ref_t key_ref,
3509 const struct cred *cred, key_perm_t perm) 3509 const struct cred *cred, unsigned perm)
3510{ 3510{
3511 struct key *keyp; 3511 struct key *keyp;
3512 struct smk_audit_info ad; 3512 struct smk_audit_info ad;
3513 struct smack_known *tkp = smk_of_task(cred->security); 3513 struct smack_known *tkp = smk_of_task(cred->security);
3514 int request = 0;
3514 3515
3515 keyp = key_ref_to_ptr(key_ref); 3516 keyp = key_ref_to_ptr(key_ref);
3516 if (keyp == NULL) 3517 if (keyp == NULL)
@@ -3531,7 +3532,11 @@ static int smack_key_permission(key_ref_t key_ref,
3531 ad.a.u.key_struct.key = keyp->serial; 3532 ad.a.u.key_struct.key = keyp->serial;
3532 ad.a.u.key_struct.key_desc = keyp->description; 3533 ad.a.u.key_struct.key_desc = keyp->description;
3533#endif 3534#endif
3534 return smk_access(tkp, keyp->security, MAY_READWRITE, &ad); 3535 if (perm & KEY_NEED_READ)
3536 request = MAY_READ;
3537 if (perm & (KEY_NEED_WRITE | KEY_NEED_LINK | KEY_NEED_SETATTR))
3538 request = MAY_WRITE;
3539 return smk_access(tkp, keyp->security, request, &ad);
3535} 3540}
3536#endif /* CONFIG_KEYS */ 3541#endif /* CONFIG_KEYS */
3537 3542