Skip to content

Commit eb3a04a

Browse files
author
Miklos Szeredi
committed
ovl: don't allow datadir only
In theory overlayfs could support upper layer directly referring to a data layer, but there's no current use case for this. Originally, when data-only layers were introduced, this wasn't allowed, only introduced by the "datadir+" feature, but without actually handling this case, resulting in an Oops. Fix by disallowing datadir without lowerdir. Reported-by: Giuseppe Scrivano <gscrivan@redhat.com> Fixes: 24e16e3 ("ovl: add support for appending lowerdirs one by one") Cc: <stable@vger.kernel.org> # v6.7 Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Alexander Larsson <alexl@redhat.com> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 0af2f6b commit eb3a04a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/overlayfs/super.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,11 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
11381138
return ERR_PTR(-EINVAL);
11391139
}
11401140

1141+
if (ctx->nr == ctx->nr_data) {
1142+
pr_err("at least one non-data lowerdir is required\n");
1143+
return ERR_PTR(-EINVAL);
1144+
}
1145+
11411146
err = -EINVAL;
11421147
for (i = 0; i < ctx->nr; i++) {
11431148
l = &ctx->lower[i];

0 commit comments

Comments
 (0)