diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/apparmorfs.c | 20 | ||||
-rw-r--r-- | security/inode.c | 21 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 20 | ||||
-rw-r--r-- | security/smack/smackfs.c | 34 |
4 files changed, 67 insertions, 28 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 66d0b4245ef6..45d13b6462aa 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/capability.h> | 19 | #include <linux/capability.h> |
20 | #include <linux/rcupdate.h> | 20 | #include <linux/rcupdate.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/fs_context.h> | ||
22 | #include <linux/poll.h> | 23 | #include <linux/poll.h> |
23 | #include <uapi/linux/major.h> | 24 | #include <uapi/linux/major.h> |
24 | #include <uapi/linux/magic.h> | 25 | #include <uapi/linux/magic.h> |
@@ -132,7 +133,7 @@ static const struct super_operations aafs_super_ops = { | |||
132 | .show_path = aafs_show_path, | 133 | .show_path = aafs_show_path, |
133 | }; | 134 | }; |
134 | 135 | ||
135 | static int fill_super(struct super_block *sb, void *data, int silent) | 136 | static int apparmorfs_fill_super(struct super_block *sb, struct fs_context *fc) |
136 | { | 137 | { |
137 | static struct tree_descr files[] = { {""} }; | 138 | static struct tree_descr files[] = { {""} }; |
138 | int error; | 139 | int error; |
@@ -145,16 +146,25 @@ static int fill_super(struct super_block *sb, void *data, int silent) | |||
145 | return 0; | 146 | return 0; |
146 | } | 147 | } |
147 | 148 | ||
148 | static struct dentry *aafs_mount(struct file_system_type *fs_type, | 149 | static int apparmorfs_get_tree(struct fs_context *fc) |
149 | int flags, const char *dev_name, void *data) | ||
150 | { | 150 | { |
151 | return mount_single(fs_type, flags, data, fill_super); | 151 | return get_tree_single(fc, apparmorfs_fill_super); |
152 | } | ||
153 | |||
154 | static const struct fs_context_operations apparmorfs_context_ops = { | ||
155 | .get_tree = apparmorfs_get_tree, | ||
156 | }; | ||
157 | |||
158 | static int apparmorfs_init_fs_context(struct fs_context *fc) | ||
159 | { | ||
160 | fc->ops = &apparmorfs_context_ops; | ||
161 | return 0; | ||
152 | } | 162 | } |
153 | 163 | ||
154 | static struct file_system_type aafs_ops = { | 164 | static struct file_system_type aafs_ops = { |
155 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
156 | .name = AAFS_NAME, | 166 | .name = AAFS_NAME, |
157 | .mount = aafs_mount, | 167 | .init_fs_context = apparmorfs_init_fs_context, |
158 | .kill_sb = kill_anon_super, | 168 | .kill_sb = kill_anon_super, |
159 | }; | 169 | }; |
160 | 170 | ||
diff --git a/security/inode.c b/security/inode.c index fcff7f08bb1c..6c326939750d 100644 --- a/security/inode.c +++ b/security/inode.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sysfs.h> | 13 | #include <linux/sysfs.h> |
14 | #include <linux/kobject.h> | 14 | #include <linux/kobject.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/fs_context.h> | ||
16 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
17 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
@@ -36,7 +37,7 @@ static const struct super_operations securityfs_super_operations = { | |||
36 | .free_inode = securityfs_free_inode, | 37 | .free_inode = securityfs_free_inode, |
37 | }; | 38 | }; |
38 | 39 | ||
39 | static int fill_super(struct super_block *sb, void *data, int silent) | 40 | static int securityfs_fill_super(struct super_block *sb, struct fs_context *fc) |
40 | { | 41 | { |
41 | static const struct tree_descr files[] = {{""}}; | 42 | static const struct tree_descr files[] = {{""}}; |
42 | int error; | 43 | int error; |
@@ -50,17 +51,25 @@ static int fill_super(struct super_block *sb, void *data, int silent) | |||
50 | return 0; | 51 | return 0; |
51 | } | 52 | } |
52 | 53 | ||
53 | static struct dentry *get_sb(struct file_system_type *fs_type, | 54 | static int securityfs_get_tree(struct fs_context *fc) |
54 | int flags, const char *dev_name, | ||
55 | void *data) | ||
56 | { | 55 | { |
57 | return mount_single(fs_type, flags, data, fill_super); | 56 | return get_tree_single(fc, securityfs_fill_super); |
57 | } | ||
58 | |||
59 | static const struct fs_context_operations securityfs_context_ops = { | ||
60 | .get_tree = securityfs_get_tree, | ||
61 | }; | ||
62 | |||
63 | static int securityfs_init_fs_context(struct fs_context *fc) | ||
64 | { | ||
65 | fc->ops = &securityfs_context_ops; | ||
66 | return 0; | ||
58 | } | 67 | } |
59 | 68 | ||
60 | static struct file_system_type fs_type = { | 69 | static struct file_system_type fs_type = { |
61 | .owner = THIS_MODULE, | 70 | .owner = THIS_MODULE, |
62 | .name = "securityfs", | 71 | .name = "securityfs", |
63 | .mount = get_sb, | 72 | .init_fs_context = securityfs_init_fs_context, |
64 | .kill_sb = kill_litter_super, | 73 | .kill_sb = kill_litter_super, |
65 | }; | 74 | }; |
66 | 75 | ||
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 6f195c7915de..e6c7643c3fc0 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/fs_context.h> | ||
20 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
21 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -1891,7 +1892,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name, | |||
1891 | 1892 | ||
1892 | #define NULL_FILE_NAME "null" | 1893 | #define NULL_FILE_NAME "null" |
1893 | 1894 | ||
1894 | static int sel_fill_super(struct super_block *sb, void *data, int silent) | 1895 | static int sel_fill_super(struct super_block *sb, struct fs_context *fc) |
1895 | { | 1896 | { |
1896 | struct selinux_fs_info *fsi; | 1897 | struct selinux_fs_info *fsi; |
1897 | int ret; | 1898 | int ret; |
@@ -2007,10 +2008,19 @@ err: | |||
2007 | return ret; | 2008 | return ret; |
2008 | } | 2009 | } |
2009 | 2010 | ||
2010 | static struct dentry *sel_mount(struct file_system_type *fs_type, | 2011 | static int sel_get_tree(struct fs_context *fc) |
2011 | int flags, const char *dev_name, void *data) | ||
2012 | { | 2012 | { |
2013 | return mount_single(fs_type, flags, data, sel_fill_super); | 2013 | return get_tree_single(fc, sel_fill_super); |
2014 | } | ||
2015 | |||
2016 | static const struct fs_context_operations sel_context_ops = { | ||
2017 | .get_tree = sel_get_tree, | ||
2018 | }; | ||
2019 | |||
2020 | static int sel_init_fs_context(struct fs_context *fc) | ||
2021 | { | ||
2022 | fc->ops = &sel_context_ops; | ||
2023 | return 0; | ||
2014 | } | 2024 | } |
2015 | 2025 | ||
2016 | static void sel_kill_sb(struct super_block *sb) | 2026 | static void sel_kill_sb(struct super_block *sb) |
@@ -2021,7 +2031,7 @@ static void sel_kill_sb(struct super_block *sb) | |||
2021 | 2031 | ||
2022 | static struct file_system_type sel_fs_type = { | 2032 | static struct file_system_type sel_fs_type = { |
2023 | .name = "selinuxfs", | 2033 | .name = "selinuxfs", |
2024 | .mount = sel_mount, | 2034 | .init_fs_context = sel_init_fs_context, |
2025 | .kill_sb = sel_kill_sb, | 2035 | .kill_sb = sel_kill_sb, |
2026 | }; | 2036 | }; |
2027 | 2037 | ||
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index ef0d8712d318..e3e05c04dbd1 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/ctype.h> | 23 | #include <linux/ctype.h> |
24 | #include <linux/audit.h> | 24 | #include <linux/audit.h> |
25 | #include <linux/magic.h> | 25 | #include <linux/magic.h> |
26 | #include <linux/fs_context.h> | ||
26 | #include "smack.h" | 27 | #include "smack.h" |
27 | 28 | ||
28 | #define BEBITS (sizeof(__be32) * 8) | 29 | #define BEBITS (sizeof(__be32) * 8) |
@@ -2816,14 +2817,13 @@ static const struct file_operations smk_ptrace_ops = { | |||
2816 | /** | 2817 | /** |
2817 | * smk_fill_super - fill the smackfs superblock | 2818 | * smk_fill_super - fill the smackfs superblock |
2818 | * @sb: the empty superblock | 2819 | * @sb: the empty superblock |
2819 | * @data: unused | 2820 | * @fc: unused |
2820 | * @silent: unused | ||
2821 | * | 2821 | * |
2822 | * Fill in the well known entries for the smack filesystem | 2822 | * Fill in the well known entries for the smack filesystem |
2823 | * | 2823 | * |
2824 | * Returns 0 on success, an error code on failure | 2824 | * Returns 0 on success, an error code on failure |
2825 | */ | 2825 | */ |
2826 | static int smk_fill_super(struct super_block *sb, void *data, int silent) | 2826 | static int smk_fill_super(struct super_block *sb, struct fs_context *fc) |
2827 | { | 2827 | { |
2828 | int rc; | 2828 | int rc; |
2829 | 2829 | ||
@@ -2893,25 +2893,35 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) | |||
2893 | } | 2893 | } |
2894 | 2894 | ||
2895 | /** | 2895 | /** |
2896 | * smk_mount - get the smackfs superblock | 2896 | * smk_get_tree - get the smackfs superblock |
2897 | * @fs_type: passed along without comment | 2897 | * @fc: The mount context, including any options |
2898 | * @flags: passed along without comment | ||
2899 | * @dev_name: passed along without comment | ||
2900 | * @data: passed along without comment | ||
2901 | * | 2898 | * |
2902 | * Just passes everything along. | 2899 | * Just passes everything along. |
2903 | * | 2900 | * |
2904 | * Returns what the lower level code does. | 2901 | * Returns what the lower level code does. |
2905 | */ | 2902 | */ |
2906 | static struct dentry *smk_mount(struct file_system_type *fs_type, | 2903 | static int smk_get_tree(struct fs_context *fc) |
2907 | int flags, const char *dev_name, void *data) | ||
2908 | { | 2904 | { |
2909 | return mount_single(fs_type, flags, data, smk_fill_super); | 2905 | return get_tree_single(fc, smk_fill_super); |
2906 | } | ||
2907 | |||
2908 | static const struct fs_context_operations smk_context_ops = { | ||
2909 | .get_tree = smk_get_tree, | ||
2910 | }; | ||
2911 | |||
2912 | /** | ||
2913 | * smk_init_fs_context - Initialise a filesystem context for smackfs | ||
2914 | * @fc: The blank mount context | ||
2915 | */ | ||
2916 | static int smk_init_fs_context(struct fs_context *fc) | ||
2917 | { | ||
2918 | fc->ops = &smk_context_ops; | ||
2919 | return 0; | ||
2910 | } | 2920 | } |
2911 | 2921 | ||
2912 | static struct file_system_type smk_fs_type = { | 2922 | static struct file_system_type smk_fs_type = { |
2913 | .name = "smackfs", | 2923 | .name = "smackfs", |
2914 | .mount = smk_mount, | 2924 | .init_fs_context = smk_init_fs_context, |
2915 | .kill_sb = kill_litter_super, | 2925 | .kill_sb = kill_litter_super, |
2916 | }; | 2926 | }; |
2917 | 2927 | ||