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 <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -1206,7 +1206,7 @@ static int nfs_get_option_ul_bound(substring_t args[], unsigned long *option,
|
||||
static int nfs_parse_mount_options(char *raw,
|
||||
struct nfs_parsed_mount_data *mnt)
|
||||
{
|
||||
char *p, *string, *secdata;
|
||||
char *p, *string;
|
||||
int rc, sloppy = 0, invalid_option = 0;
|
||||
unsigned short protofamily = AF_UNSPEC;
|
||||
unsigned short mountfamily = AF_UNSPEC;
|
||||
@@ -1217,20 +1217,10 @@ static int nfs_parse_mount_options(char *raw,
|
||||
}
|
||||
dfprintk(MOUNT, "NFS: nfs mount opts='%s'\n", raw);
|
||||
|
||||
secdata = alloc_secdata();
|
||||
if (!secdata)
|
||||
goto out_nomem;
|
||||
|
||||
rc = security_sb_copy_data(raw, secdata);
|
||||
rc = security_sb_eat_lsm_opts(raw, &mnt->lsm_opts);
|
||||
if (rc)
|
||||
goto out_security_failure;
|
||||
|
||||
rc = security_sb_parse_opts_str(secdata, &mnt->lsm_opts);
|
||||
if (rc)
|
||||
goto out_security_failure;
|
||||
|
||||
free_secdata(secdata);
|
||||
|
||||
while ((p = strsep(&raw, ",")) != NULL) {
|
||||
substring_t args[MAX_OPT_ARGS];
|
||||
unsigned long option;
|
||||
@@ -1682,7 +1672,6 @@ out_nomem:
|
||||
printk(KERN_INFO "NFS: not enough memory to parse option\n");
|
||||
return 0;
|
||||
out_security_failure:
|
||||
free_secdata(secdata);
|
||||
printk(KERN_INFO "NFS: security options invalid: %d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user