Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NULL as mount(2) syscall data parameter #3804

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions module/zfs/zpl_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ static const match_table_t zpl_tokens = {
};

static int
zpl_parse_option(char *option, int token, substring_t *args,
zfs_mntopts_t *zmo, boolean_t isremount)
zpl_parse_option(char *option, int token, substring_t *args, zfs_mntopts_t *zmo)
{
switch (token) {
case TOKEN_RO:
Expand Down Expand Up @@ -318,32 +317,34 @@ zpl_parse_options(char *osname, char *mntopts, zfs_mntopts_t *zmo,
boolean_t isremount)
{
zfs_mntopts_t *tmp_zmo;
substring_t args[MAX_OPT_ARGS];
char *tmp_mntopts, *p;
int error, token;

if (mntopts == NULL)
return (-EINVAL);
int error;

tmp_zmo = zfs_mntopts_alloc();
tmp_zmo->z_osname = strdup(osname);
tmp_mntopts = strdup(mntopts);

while ((p = strsep(&tmp_mntopts, ",")) != NULL) {
if (!*p)
continue;

args[0].to = args[0].from = NULL;
token = match_token(p, zpl_tokens, args);
error = zpl_parse_option(p, token, args, tmp_zmo, isremount);
if (error) {
zfs_mntopts_free(tmp_zmo);
strfree(tmp_mntopts);
return (error);

if (mntopts) {
substring_t args[MAX_OPT_ARGS];
char *tmp_mntopts, *p;
int token;

tmp_mntopts = strdup(mntopts);

while ((p = strsep(&tmp_mntopts, ",")) != NULL) {
if (!*p)
continue;

args[0].to = args[0].from = NULL;
token = match_token(p, zpl_tokens, args);
error = zpl_parse_option(p, token, args, tmp_zmo);
if (error) {
zfs_mntopts_free(tmp_zmo);
strfree(tmp_mntopts);
return (error);
}
}
}

strfree(tmp_mntopts);
strfree(tmp_mntopts);
}

if (isremount == B_TRUE) {
if (zmo->z_osname)
Expand Down