Commit 91c77947 authored by Miklos Szeredi's avatar Miklos Szeredi

ovl: allow filenames with comma

Allow option separator (comma) to be escaped with backslash.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 52148463
......@@ -462,11 +462,34 @@ static const match_table_t ovl_tokens = {
{OPT_ERR, NULL}
};
static char *ovl_next_opt(char **s)
{
char *sbegin = *s;
char *p;
if (sbegin == NULL)
return NULL;
for (p = sbegin; *p; p++) {
if (*p == '\\') {
p++;
if (!*p)
break;
} else if (*p == ',') {
*p = '\0';
*s = p + 1;
return sbegin;
}
}
*s = NULL;
return sbegin;
}
static int ovl_parse_opt(char *opt, struct ovl_config *config)
{
char *p;
while ((p = strsep(&opt, ",")) != NULL) {
while ((p = ovl_next_opt(&opt)) != NULL) {
int token;
substring_t args[MAX_OPT_ARGS];
......@@ -554,15 +577,34 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt,
goto out_unlock;
}
static void ovl_unescape(char *s)
{
char *d = s;
for (;; s++, d++) {
if (*s == '\\')
s++;
*d = *s;
if (!*s)
break;
}
}
static int ovl_mount_dir(const char *name, struct path *path)
{
int err;
char *tmp = kstrdup(name, GFP_KERNEL);
if (!tmp)
return -ENOMEM;
err = kern_path(name, LOOKUP_FOLLOW, path);
ovl_unescape(tmp);
err = kern_path(tmp, LOOKUP_FOLLOW, path);
if (err) {
pr_err("overlayfs: failed to resolve '%s': %i\n", name, err);
pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err);
err = -EINVAL;
}
kfree(tmp);
return err;
}
......
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