aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-13 18:35:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-07-21 13:10:01 -0400
commit28dd1f346b2f0fc2ab8285046ed0bd91e9b808d3 (patch)
tree7c2a4337b103067684f0345283d19c8e8e62afb2 /security
parent9924f6e89823a41bfd272ab759636276b9f9ee9c (diff)
sysfs: Create mountpoints with sysfs_create_mount_point
commit f9bb48825a6b5d02f4cabcc78967c75db903dcdc upstream. This allows for better documentation in the code and it allows for a simpler and fully correct version of fs_fully_visible to be written. The mount points converted and their filesystems are: /sys/hypervisor/s390/ s390_hypfs /sys/kernel/config/ configfs /sys/kernel/debug/ debugfs /sys/firmware/efi/efivars/ efivarfs /sys/fs/fuse/connections/ fusectl /sys/fs/pstore/ pstore /sys/kernel/tracing/ tracefs /sys/fs/cgroup/ cgroup /sys/kernel/security/ securityfs /sys/fs/selinux/ selinuxfs /sys/fs/smackfs/ smackfs Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/inode.c10
-rw-r--r--security/selinux/selinuxfs.c11
-rw-r--r--security/smack/smackfs.c8
3 files changed, 13 insertions, 16 deletions
diff --git a/security/inode.c b/security/inode.c
index 91503b79c5f8..0e37e4fba8fa 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -215,19 +215,17 @@ void securityfs_remove(struct dentry *dentry)
215} 215}
216EXPORT_SYMBOL_GPL(securityfs_remove); 216EXPORT_SYMBOL_GPL(securityfs_remove);
217 217
218static struct kobject *security_kobj;
219
220static int __init securityfs_init(void) 218static int __init securityfs_init(void)
221{ 219{
222 int retval; 220 int retval;
223 221
224 security_kobj = kobject_create_and_add("security", kernel_kobj); 222 retval = sysfs_create_mount_point(kernel_kobj, "security");
225 if (!security_kobj) 223 if (retval)
226 return -EINVAL; 224 return retval;
227 225
228 retval = register_filesystem(&fs_type); 226 retval = register_filesystem(&fs_type);
229 if (retval) 227 if (retval)
230 kobject_put(security_kobj); 228 sysfs_remove_mount_point(kernel_kobj, "security");
231 return retval; 229 return retval;
232} 230}
233 231
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index d2787cca1fcb..3d2201413028 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1853,7 +1853,6 @@ static struct file_system_type sel_fs_type = {
1853}; 1853};
1854 1854
1855struct vfsmount *selinuxfs_mount; 1855struct vfsmount *selinuxfs_mount;
1856static struct kobject *selinuxfs_kobj;
1857 1856
1858static int __init init_sel_fs(void) 1857static int __init init_sel_fs(void)
1859{ 1858{
@@ -1862,13 +1861,13 @@ static int __init init_sel_fs(void)
1862 if (!selinux_enabled) 1861 if (!selinux_enabled)
1863 return 0; 1862 return 0;
1864 1863
1865 selinuxfs_kobj = kobject_create_and_add("selinux", fs_kobj); 1864 err = sysfs_create_mount_point(fs_kobj, "selinux");
1866 if (!selinuxfs_kobj) 1865 if (err)
1867 return -ENOMEM; 1866 return err;
1868 1867
1869 err = register_filesystem(&sel_fs_type); 1868 err = register_filesystem(&sel_fs_type);
1870 if (err) { 1869 if (err) {
1871 kobject_put(selinuxfs_kobj); 1870 sysfs_remove_mount_point(fs_kobj, "selinux");
1872 return err; 1871 return err;
1873 } 1872 }
1874 1873
@@ -1887,7 +1886,7 @@ __initcall(init_sel_fs);
1887#ifdef CONFIG_SECURITY_SELINUX_DISABLE 1886#ifdef CONFIG_SECURITY_SELINUX_DISABLE
1888void exit_sel_fs(void) 1887void exit_sel_fs(void)
1889{ 1888{
1890 kobject_put(selinuxfs_kobj); 1889 sysfs_remove_mount_point(fs_kobj, "selinux");
1891 kern_unmount(selinuxfs_mount); 1890 kern_unmount(selinuxfs_mount);
1892 unregister_filesystem(&sel_fs_type); 1891 unregister_filesystem(&sel_fs_type);
1893} 1892}
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index d9682985349e..ac4cac7c661a 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -2241,16 +2241,16 @@ static const struct file_operations smk_revoke_subj_ops = {
2241 .llseek = generic_file_llseek, 2241 .llseek = generic_file_llseek,
2242}; 2242};
2243 2243
2244static struct kset *smackfs_kset;
2245/** 2244/**
2246 * smk_init_sysfs - initialize /sys/fs/smackfs 2245 * smk_init_sysfs - initialize /sys/fs/smackfs
2247 * 2246 *
2248 */ 2247 */
2249static int smk_init_sysfs(void) 2248static int smk_init_sysfs(void)
2250{ 2249{
2251 smackfs_kset = kset_create_and_add("smackfs", NULL, fs_kobj); 2250 int err;
2252 if (!smackfs_kset) 2251 err = sysfs_create_mount_point(fs_kobj, "smackfs");
2253 return -ENOMEM; 2252 if (err)
2253 return err;
2254 return 0; 2254 return 0;
2255} 2255}
2256 2256