diff options
-rw-r--r-- | security/smack/smack_lsm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c47dd8ca019c..8177e7df8c2d 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -3511,6 +3511,7 @@ static int smack_key_permission(key_ref_t key_ref, | |||
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 | ||