提交 d21b7b04 编写于 作者: J José Bollo 提交者: Casey Schaufler

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: NJosé Bollo <jose.bollo@iot.bzh>
Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
上级 8b549ef4
......@@ -4708,8 +4708,6 @@ static __init int smack_init(void)
if (!security_module_enable("smack"))
return 0;
smack_enabled = 1;
smack_inode_cache = KMEM_CACHE(inode_smack, 0);
if (!smack_inode_cache)
return -ENOMEM;
......@@ -4721,6 +4719,8 @@ static __init int smack_init(void)
return -ENOMEM;
}
smack_enabled = 1;
pr_info("Smack: Initializing.\n");
#ifdef CONFIG_SECURITY_SMACK_NETFILTER
pr_info("Smack: Netfilter enabled.\n");
......
......@@ -2892,7 +2892,7 @@ static int __init init_smk_fs(void)
int err;
int rc;
if (!security_module_enable("smack"))
if (smack_enabled == 0)
return 0;
err = smk_init_sysfs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册