Message ID | 20250210194512.417339-1-mszeredi@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/5] ovl: don't allow datadir only | expand |
On Mon, Feb 10, 2025 at 8:45 PM Miklos Szeredi <mszeredi@redhat.com> wrote: > > 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+" feture, but without actually handling Spelling s/feture/feature > this case, resuting in an Oops. Spelling s/resuting/resulting > > Fix by disallowing datadir without lowerdir. > > Reported-by: Giuseppe Scrivano <gscrivan@redhat.com> > Fixes: 24e16e385f22 ("ovl: add support for appending lowerdirs one by one") > Cc: <stable@vger.kernel.org> # v6.7 > Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> > --- > fs/overlayfs/super.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > index 86ae6f6da36b..b11094acdd8f 100644 > --- a/fs/overlayfs/super.c > +++ b/fs/overlayfs/super.c > @@ -1137,6 +1137,11 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb, > return ERR_PTR(-EINVAL); > } > > + if (ctx->nr == ctx->nr_data) { > + pr_err("at least one non-data lowerdir is required\n"); > + return ERR_PTR(-EINVAL); > + } > + > err = -EINVAL; > for (i = 0; i < ctx->nr; i++) { > l = &ctx->lower[i]; > -- > 2.48.1 >
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 86ae6f6da36b..b11094acdd8f 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1137,6 +1137,11 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb, return ERR_PTR(-EINVAL); } + if (ctx->nr == ctx->nr_data) { + pr_err("at least one non-data lowerdir is required\n"); + return ERR_PTR(-EINVAL); + } + err = -EINVAL; for (i = 0; i < ctx->nr; i++) { l = &ctx->lower[i];
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+" feture, but without actually handling this case, resuting in an Oops. Fix by disallowing datadir without lowerdir. Reported-by: Giuseppe Scrivano <gscrivan@redhat.com> Fixes: 24e16e385f22 ("ovl: add support for appending lowerdirs one by one") Cc: <stable@vger.kernel.org> # v6.7 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> --- fs/overlayfs/super.c | 5 +++++ 1 file changed, 5 insertions(+)