Skip to content

Commit c34706a

Browse files
committed
ovl: fix regression in parsing of mount options with escaped comma
Ever since commit 91c7794 ("ovl: allow filenames with comma"), the following example was legit overlayfs mount options: mount -t overlay overlay -o 'lowerdir=/tmp/a\,b/lower' /mnt The conversion to new mount api moved to using the common helper generic_parse_monolithic() and discarded the specialized ovl_next_opt() option separator. Bring back ovl_next_opt() and use vfs_parse_monolithic_sep() to fix the regression. Reported-by: Ryan Hendrickson <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Fixes: 1784fbc ("ovl: port to new mount api") Signed-off-by: Amir Goldstein <[email protected]>
1 parent e001d14 commit c34706a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

fs/overlayfs/params.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,34 @@ const struct fs_parameter_spec ovl_parameter_spec[] = {
157157
{}
158158
};
159159

160+
static char *ovl_next_opt(char **s)
161+
{
162+
char *sbegin = *s;
163+
char *p;
164+
165+
if (sbegin == NULL)
166+
return NULL;
167+
168+
for (p = sbegin; *p; p++) {
169+
if (*p == '\\') {
170+
p++;
171+
if (!*p)
172+
break;
173+
} else if (*p == ',') {
174+
*p = '\0';
175+
*s = p + 1;
176+
return sbegin;
177+
}
178+
}
179+
*s = NULL;
180+
return sbegin;
181+
}
182+
183+
static int ovl_parse_monolithic(struct fs_context *fc, void *data)
184+
{
185+
return vfs_parse_monolithic_sep(fc, data, ovl_next_opt);
186+
}
187+
160188
static ssize_t ovl_parse_param_split_lowerdirs(char *str)
161189
{
162190
ssize_t nr_layers = 1, nr_colons = 0;
@@ -682,6 +710,7 @@ static int ovl_reconfigure(struct fs_context *fc)
682710
}
683711

684712
static const struct fs_context_operations ovl_context_ops = {
713+
.parse_monolithic = ovl_parse_monolithic,
685714
.parse_param = ovl_parse_param,
686715
.get_tree = ovl_get_tree,
687716
.reconfigure = ovl_reconfigure,

0 commit comments

Comments
 (0)