diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4bef86ed463b..74dd46de01b6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -6502,7 +6502,6 @@ static int selinux_key_permission(key_ref_t key_ref, | |||
6502 | { | 6502 | { |
6503 | struct key *key; | 6503 | struct key *key; |
6504 | struct key_security_struct *ksec; | 6504 | struct key_security_struct *ksec; |
6505 | unsigned oldstyle_perm; | ||
6506 | u32 sid; | 6505 | u32 sid; |
6507 | 6506 | ||
6508 | /* if no specific permissions are requested, we skip the | 6507 | /* if no specific permissions are requested, we skip the |
@@ -6511,26 +6510,13 @@ static int selinux_key_permission(key_ref_t key_ref, | |||
6511 | if (perm == 0) | 6510 | if (perm == 0) |
6512 | return 0; | 6511 | return 0; |
6513 | 6512 | ||
6514 | oldstyle_perm = perm & (KEY_NEED_VIEW | KEY_NEED_READ | KEY_NEED_WRITE | | ||
6515 | KEY_NEED_SEARCH | KEY_NEED_LINK); | ||
6516 | if (perm & KEY_NEED_SETSEC) | ||
6517 | oldstyle_perm |= OLD_KEY_NEED_SETATTR; | ||
6518 | if (perm & KEY_NEED_INVAL) | ||
6519 | oldstyle_perm |= KEY_NEED_SEARCH; | ||
6520 | if (perm & KEY_NEED_REVOKE && !(perm & OLD_KEY_NEED_SETATTR)) | ||
6521 | oldstyle_perm |= KEY_NEED_WRITE; | ||
6522 | if (perm & KEY_NEED_JOIN) | ||
6523 | oldstyle_perm |= KEY_NEED_SEARCH; | ||
6524 | if (perm & KEY_NEED_CLEAR) | ||
6525 | oldstyle_perm |= KEY_NEED_WRITE; | ||
6526 | |||
6527 | sid = cred_sid(cred); | 6513 | sid = cred_sid(cred); |
6528 | 6514 | ||
6529 | key = key_ref_to_ptr(key_ref); | 6515 | key = key_ref_to_ptr(key_ref); |
6530 | ksec = key->security; | 6516 | ksec = key->security; |
6531 | 6517 | ||
6532 | return avc_has_perm(&selinux_state, | 6518 | return avc_has_perm(&selinux_state, |
6533 | sid, ksec->sid, SECCLASS_KEY, oldstyle_perm, NULL); | 6519 | sid, ksec->sid, SECCLASS_KEY, perm, NULL); |
6534 | } | 6520 | } |
6535 | 6521 | ||
6536 | static int selinux_key_getsecurity(struct key *key, char **_buffer) | 6522 | static int selinux_key_getsecurity(struct key *key, char **_buffer) |