aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-12-01 22:42:44 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-12-21 11:45:30 -0500
commit6be8750b4cba8c37170f46b29841d112f1be749b (patch)
tree0b3386c080d73fc666afcdcd1db5290b990af349 /security/selinux/hooks.c
parent6466f3d193a99426db067855345e763de2160f1c (diff)
LSM: lift parsing LSM options into the caller of ->sb_kern_mount()
This paves the way for retaining the LSM options from a common filesystem mount context during a mount parameter parsing phase to be instituted prior to actual mount/reconfiguration actions. Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 4bd6f9435e2f..ba229d4a64d3 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2897,30 +2897,12 @@ out_bad_option:
2897 goto out_free_opts; 2897 goto out_free_opts;
2898} 2898}
2899 2899
2900static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) 2900static int selinux_sb_kern_mount(struct super_block *sb, int flags,
2901 struct security_mnt_opts *opts)
2901{ 2902{
2902 char *options = data;
2903 const struct cred *cred = current_cred(); 2903 const struct cred *cred = current_cred();
2904 struct common_audit_data ad; 2904 struct common_audit_data ad;
2905 int rc = 0; 2905 int rc = selinux_set_mnt_opts(sb, opts, 0, NULL);
2906 struct security_mnt_opts opts;
2907
2908 security_init_mnt_opts(&opts);
2909
2910 if (!data)
2911 goto out;
2912
2913 BUG_ON(sb->s_type->fs_flags & FS_BINARY_MOUNTDATA);
2914
2915 rc = selinux_parse_opts_str(options, &opts);
2916 if (rc)
2917 goto out_err;
2918
2919out:
2920 rc = selinux_set_mnt_opts(sb, &opts, 0, NULL);
2921
2922out_err:
2923 security_free_mnt_opts(&opts);
2924 if (rc) 2906 if (rc)
2925 return rc; 2907 return rc;
2926 2908