From 6131862c0235e927d3357dfde740de5dea47c364 Mon Sep 17 00:00:00 2001 From: Brad Peters Date: Thu, 25 Jul 2013 11:10:05 -0700 Subject: [PATCH] Add Smack mount point in sysfs Ported from upstream for 3.0.8 Mobile by brad.t.peters@intel.com Original commit: From: Casey Schaufler There are a number of "conventions" for where to put LSM filesystems. Smack adheres to none of them. Create a mount point at /sys/fs/smackfs for mounting smackfs so that Smack can be conventional. Targeted for git://git.gitorious.org/smack-next/kernel.git Signed-off-by: Casey Schaufler --- security/smack/smackfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 99929a5..e8d3e78 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -2063,6 +2063,20 @@ static const struct file_operations smk_revoke_subj_ops = { .llseek = generic_file_llseek, }; +static struct kset *smackfs_kset; +/** + * smk_init_sysfs - initialize /sys/fs/smackfs + * + */ +static int smk_init_sysfs(void) +{ + smackfs_kset = kset_create_and_add("smackfs", NULL, fs_kobj); + if (!smackfs_kset) + return -ENOMEM; + return 0; +} + + /** * smk_fill_super - fill the /smackfs superblock * @sb: the empty superblock @@ -2183,6 +2197,10 @@ static int __init init_smk_fs(void) if (!security_module_enable(&smack_ops)) return 0; + err = smk_init_sysfs(); + if (err) + printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n"); + err = register_filesystem(&smk_fs_type); if (!err) { smackfs_mount = kern_mount(&smk_fs_type); -- 2.7.4