Commit 17f3b556 authored by Al Viro's avatar Al Viro Committed by David Howells

selinux: expand superblock_doinit() calls

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
parent 43f5e655
...@@ -1202,33 +1202,6 @@ static int selinux_parse_opts_str(char *options, ...@@ -1202,33 +1202,6 @@ static int selinux_parse_opts_str(char *options,
kfree(rootcontext); kfree(rootcontext);
return rc; return rc;
} }
/*
* string mount options parsing and call set the sbsec
*/
static int superblock_doinit(struct super_block *sb, void *data)
{
int rc = 0;
char *options = data;
struct security_mnt_opts opts;
security_init_mnt_opts(&opts);
if (!data)
goto out;
BUG_ON(sb->s_type->fs_flags & FS_BINARY_MOUNTDATA);
rc = selinux_parse_opts_str(options, &opts);
if (rc)
goto out_err;
out:
rc = selinux_set_mnt_opts(sb, &opts, 0, NULL);
out_err:
security_free_mnt_opts(&opts);
return rc;
}
static void selinux_write_opts(struct seq_file *m, static void selinux_write_opts(struct seq_file *m,
struct security_mnt_opts *opts) struct security_mnt_opts *opts)
...@@ -2926,11 +2899,28 @@ static int selinux_sb_remount(struct super_block *sb, void *data) ...@@ -2926,11 +2899,28 @@ static int selinux_sb_remount(struct super_block *sb, void *data)
static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data)
{ {
char *options = data;
const struct cred *cred = current_cred(); const struct cred *cred = current_cred();
struct common_audit_data ad; struct common_audit_data ad;
int rc; int rc = 0;
struct security_mnt_opts opts;
security_init_mnt_opts(&opts);
if (!data)
goto out;
BUG_ON(sb->s_type->fs_flags & FS_BINARY_MOUNTDATA);
rc = selinux_parse_opts_str(options, &opts);
if (rc)
goto out_err;
out:
rc = selinux_set_mnt_opts(sb, &opts, 0, NULL);
rc = superblock_doinit(sb, data); out_err:
security_free_mnt_opts(&opts);
if (rc) if (rc)
return rc; return rc;
...@@ -7194,7 +7184,11 @@ static __init int selinux_init(void) ...@@ -7194,7 +7184,11 @@ static __init int selinux_init(void)
static void delayed_superblock_init(struct super_block *sb, void *unused) static void delayed_superblock_init(struct super_block *sb, void *unused)
{ {
superblock_doinit(sb, NULL); struct security_mnt_opts opts;
security_init_mnt_opts(&opts);
selinux_set_mnt_opts(sb, &opts, 0, NULL);
security_free_mnt_opts(&opts);
} }
void selinux_complete_init(void) void selinux_complete_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment