aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 8551952ef329..c8f688a10041 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2785,7 +2785,7 @@ netlbl_secattr_to_sid_return_cleanup:
2785 */ 2785 */
2786int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr) 2786int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
2787{ 2787{
2788 int rc = -ENOENT; 2788 int rc;
2789 struct context *ctx; 2789 struct context *ctx;
2790 2790
2791 if (!ss_initialized) 2791 if (!ss_initialized)
@@ -2793,10 +2793,16 @@ int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
2793 2793
2794 read_lock(&policy_rwlock); 2794 read_lock(&policy_rwlock);
2795 ctx = sidtab_search(&sidtab, sid); 2795 ctx = sidtab_search(&sidtab, sid);
2796 if (ctx == NULL) 2796 if (ctx == NULL) {
2797 rc = -ENOENT;
2797 goto netlbl_sid_to_secattr_failure; 2798 goto netlbl_sid_to_secattr_failure;
2799 }
2798 secattr->domain = kstrdup(policydb.p_type_val_to_name[ctx->type - 1], 2800 secattr->domain = kstrdup(policydb.p_type_val_to_name[ctx->type - 1],
2799 GFP_ATOMIC); 2801 GFP_ATOMIC);
2802 if (secattr->domain == NULL) {
2803 rc = -ENOMEM;
2804 goto netlbl_sid_to_secattr_failure;
2805 }
2800 secattr->flags |= NETLBL_SECATTR_DOMAIN_CPY; 2806 secattr->flags |= NETLBL_SECATTR_DOMAIN_CPY;
2801 mls_export_netlbl_lvl(ctx, secattr); 2807 mls_export_netlbl_lvl(ctx, secattr);
2802 rc = mls_export_netlbl_cat(ctx, secattr); 2808 rc = mls_export_netlbl_cat(ctx, secattr);