new helper: security_sb_eat_lsm_opts()

combination of alloc_secdata(), security_sb_copy_data(),
security_sb_parse_opt_str() and free_secdata().

Reviewed-by: David Howells <[email protected]>
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
Al Viro 2018-11-17 12:09:18 -05:00
commit f5c0c26d90
6 changed files with 20 additions and 77 deletions

View file

@ -1252,18 +1252,7 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data)
security_init_mnt_opts(&opts);
if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) {
char *secdata = alloc_secdata();
if (!secdata)
return ERR_PTR(-ENOMEM);
error = security_sb_copy_data(data, secdata);
if (error) {
free_secdata(secdata);
return ERR_PTR(error);
}
error = security_sb_parse_opts_str(secdata, &opts);
free_secdata(secdata);
error = security_sb_eat_lsm_opts(data, &opts);
if (error)
return ERR_PTR(error);
}