aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorJosé Bollo <jobol@nonadev.net>2015-10-02 09:15:56 -0400
committerCasey Schaufler <casey@schaufler-ca.com>2015-10-09 18:13:24 -0400
commitd21b7b049c0c1753a10c1d01606f42bad0e0f733 (patch)
tree5e16c920a3229464a37b0cea3ed122f36650eac6 /security/smack
parent8b549ef42a26f4ef604a9ede84f0260103942727 (diff)
Smack: Minor initialisation improvement
This change has two goals: - delay the setting of 'smack_enabled' until it will be really effective - ensure that smackfs is valid only if 'smack_enabled' is set (it is already the case in smack_netfilter.c) Signed-off-by: José Bollo <jose.bollo@iot.bzh> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c4
-rw-r--r--security/smack/smackfs.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index f02438cc6d29..2c0579d0da20 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -4708,8 +4708,6 @@ static __init int smack_init(void)
4708 if (!security_module_enable("smack")) 4708 if (!security_module_enable("smack"))
4709 return 0; 4709 return 0;
4710 4710
4711 smack_enabled = 1;
4712
4713 smack_inode_cache = KMEM_CACHE(inode_smack, 0); 4711 smack_inode_cache = KMEM_CACHE(inode_smack, 0);
4714 if (!smack_inode_cache) 4712 if (!smack_inode_cache)
4715 return -ENOMEM; 4713 return -ENOMEM;
@@ -4721,6 +4719,8 @@ static __init int smack_init(void)
4721 return -ENOMEM; 4719 return -ENOMEM;
4722 } 4720 }
4723 4721
4722 smack_enabled = 1;
4723
4724 pr_info("Smack: Initializing.\n"); 4724 pr_info("Smack: Initializing.\n");
4725#ifdef CONFIG_SECURITY_SMACK_NETFILTER 4725#ifdef CONFIG_SECURITY_SMACK_NETFILTER
4726 pr_info("Smack: Netfilter enabled.\n"); 4726 pr_info("Smack: Netfilter enabled.\n");
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 103a619b1360..ce8d503a18a0 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -2892,7 +2892,7 @@ static int __init init_smk_fs(void)
2892 int err; 2892 int err;
2893 int rc; 2893 int rc;
2894 2894
2895 if (!security_module_enable("smack")) 2895 if (smack_enabled == 0)
2896 return 0; 2896 return 0;
2897 2897
2898 err = smk_init_sysfs(); 2898 err = smk_init_sysfs();