Skip to content

Commit 93e8172

Browse files
author
Miklos Szeredi
committed
ovl: don't allow datadir only
JIRA: https://issues.redhat.com/browse/RHEL-83562 commit eb3a04a Author: Miklos Szeredi <[email protected]> Date: Mon Feb 10 15:11:22 2025 +0100 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 <[email protected]> Fixes: 24e16e3 ("ovl: add support for appending lowerdirs one by one") Cc: <[email protected]> # v6.7 Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Alexander Larsson <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> 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 <[email protected]> Fixes: 24e16e3 ("ovl: add support for appending lowerdirs one by one") Cc: <[email protected]> # v6.7 Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Alexander Larsson <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> (cherry picked from commit eb3a04a)
1 parent a3d49f6 commit 93e8172

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
@@ -1126,6 +1126,11 @@ static struct ovl_entry *ovl_get_lowerstack(struct super_block *sb,
11261126
return ERR_PTR(-EINVAL);
11271127
}
11281128

1129+
if (ctx->nr == ctx->nr_data) {
1130+
pr_err("at least one non-data lowerdir is required\n");
1131+
return ERR_PTR(-EINVAL);
1132+
}
1133+
11291134
err = -EINVAL;
11301135
for (i = 0; i < ctx->nr; i++) {
11311136
l = &ctx->lower[i];

0 commit comments

Comments
 (0)