summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-03-25 12:38:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-07-04 22:01:59 -0400
commit920f50b2a44bbc5e332a3f84f7ad4040ee62fcc6 (patch)
treea4625e03301a470f1c9222c0bf7d2f15204023b2 /security
parent5c86d7e0433acb6f5d5f3cc2adf8ea3f6bc6bbda (diff)
vfs: Convert selinuxfs to use the new mount API
Convert the selinuxfs filesystem to the new internal mount API as the old one will be obsoleted and removed. This allows greater flexibility in communication of mount parameters between userspace, the VFS and the filesystem. See Documentation/filesystems/mount_api.txt for more information. Signed-off-by: David Howells <dhowells@redhat.com> cc: Paul Moore <paul@paul-moore.com> cc: Stephen Smalley <sds@tycho.nsa.gov> cc: Eric Paris <eparis@parisplace.org> cc: selinux@vger.kernel.org cc: linux-security-module@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/selinuxfs.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 145ee62f205a..0b3155d827a1 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -19,6 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/fs_context.h>
22#include <linux/mount.h> 23#include <linux/mount.h>
23#include <linux/mutex.h> 24#include <linux/mutex.h>
24#include <linux/init.h> 25#include <linux/init.h>
@@ -1893,7 +1894,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name,
1893 1894
1894#define NULL_FILE_NAME "null" 1895#define NULL_FILE_NAME "null"
1895 1896
1896static int sel_fill_super(struct super_block *sb, void *data, int silent) 1897static int sel_fill_super(struct super_block *sb, struct fs_context *fc)
1897{ 1898{
1898 struct selinux_fs_info *fsi; 1899 struct selinux_fs_info *fsi;
1899 int ret; 1900 int ret;
@@ -2009,10 +2010,19 @@ err:
2009 return ret; 2010 return ret;
2010} 2011}
2011 2012
2012static struct dentry *sel_mount(struct file_system_type *fs_type, 2013static int sel_get_tree(struct fs_context *fc)
2013 int flags, const char *dev_name, void *data)
2014{ 2014{
2015 return mount_single(fs_type, flags, data, sel_fill_super); 2015 return get_tree_single(fc, sel_fill_super);
2016}
2017
2018static const struct fs_context_operations sel_context_ops = {
2019 .get_tree = sel_get_tree,
2020};
2021
2022static int sel_init_fs_context(struct fs_context *fc)
2023{
2024 fc->ops = &sel_context_ops;
2025 return 0;
2016} 2026}
2017 2027
2018static void sel_kill_sb(struct super_block *sb) 2028static void sel_kill_sb(struct super_block *sb)
@@ -2023,7 +2033,7 @@ static void sel_kill_sb(struct super_block *sb)
2023 2033
2024static struct file_system_type sel_fs_type = { 2034static struct file_system_type sel_fs_type = {
2025 .name = "selinuxfs", 2035 .name = "selinuxfs",
2026 .mount = sel_mount, 2036 .init_fs_context = sel_init_fs_context,
2027 .kill_sb = sel_kill_sb, 2037 .kill_sb = sel_kill_sb,
2028}; 2038};
2029 2039