]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Smack: create a sysfs mount point for smackfs
authorCasey Schaufler <casey@schaufler-ca.com>
Fri, 2 Nov 2012 01:14:32 +0000 (18:14 -0700)
committerCasey Schaufler <casey@schaufler-ca.com>
Fri, 14 Dec 2012 18:57:23 +0000 (10:57 -0800)
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 <casey@schaufler-ca.com>
security/smack/smackfs.c

index 99929a50093aa38fdd2917974f68df9c267b9933..76a5dca46404bd62928b34a492d0534e986a34d8 100644 (file)
@@ -2063,6 +2063,19 @@ 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 +2196,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);