diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 047365ac9faa..838d1e5e63a1 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -5300,6 +5300,20 @@ static int selinux_key_permission(key_ref_t key_ref, | |||
5300 | SECCLASS_KEY, perm, NULL); | 5300 | SECCLASS_KEY, perm, NULL); |
5301 | } | 5301 | } |
5302 | 5302 | ||
5303 | static int selinux_key_getsecurity(struct key *key, char **_buffer) | ||
5304 | { | ||
5305 | struct key_security_struct *ksec = key->security; | ||
5306 | char *context = NULL; | ||
5307 | unsigned len; | ||
5308 | int rc; | ||
5309 | |||
5310 | rc = security_sid_to_context(ksec->sid, &context, &len); | ||
5311 | if (!rc) | ||
5312 | rc = len; | ||
5313 | *_buffer = context; | ||
5314 | return rc; | ||
5315 | } | ||
5316 | |||
5303 | #endif | 5317 | #endif |
5304 | 5318 | ||
5305 | static struct security_operations selinux_ops = { | 5319 | static struct security_operations selinux_ops = { |
@@ -5488,6 +5502,7 @@ static struct security_operations selinux_ops = { | |||
5488 | .key_alloc = selinux_key_alloc, | 5502 | .key_alloc = selinux_key_alloc, |
5489 | .key_free = selinux_key_free, | 5503 | .key_free = selinux_key_free, |
5490 | .key_permission = selinux_key_permission, | 5504 | .key_permission = selinux_key_permission, |
5505 | .key_getsecurity = selinux_key_getsecurity, | ||
5491 | #endif | 5506 | #endif |
5492 | 5507 | ||
5493 | #ifdef CONFIG_AUDIT | 5508 | #ifdef CONFIG_AUDIT |