linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <mszeredi@redhat.com>
To: linux-unionfs@vger.kernel.org
Cc: Amir Goldstein <amir73il@gmail.com>,
	linux-fsdevel@vger.kernel.org,
	Giuseppe Scrivano <gscrivan@redhat.com>,
	Alexander Larsson <alexl@redhat.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 1/5] ovl: don't allow datadir only
Date: Tue, 25 Mar 2025 11:46:29 +0100	[thread overview]
Message-ID: <20250325104634.162496-2-mszeredi@redhat.com> (raw)
In-Reply-To: <20250325104634.162496-1-mszeredi@redhat.com>

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: 24e16e385f22 ("ovl: add support for appending lowerdirs one by one")
Cc: <stable@vger.kernel.org> # v6.7
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.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.49.0


  reply	other threads:[~2025-03-25 10:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 10:46 [PATCH v2 0/5] ovl: metacopy/verity fixes and improvements Miklos Szeredi
2025-03-25 10:46 ` Miklos Szeredi [this message]
2025-03-25 11:57   ` [PATCH v2 1/5] ovl: don't allow datadir only Alexander Larsson
2025-03-25 14:36   ` Christian Brauner
2025-03-25 10:46 ` [PATCH v2 2/5] ovl: remove unused forward declaration Miklos Szeredi
2025-03-25 13:43   ` Alexander Larsson
2025-03-25 14:38   ` Christian Brauner
2025-03-25 10:46 ` [PATCH v2 3/5] ovl: make redirect/metacopy rejection consistent Miklos Szeredi
2025-03-25 11:13   ` Amir Goldstein
2025-03-25 13:44   ` Alexander Larsson
2025-03-25 10:46 ` [PATCH v2 4/5] ovl: relax redirect/metacopy requirements for lower -> data redirect Miklos Szeredi
2025-03-25 11:22   ` Amir Goldstein
2025-03-25 13:46   ` Alexander Larsson
2025-03-25 10:46 ` [PATCH v2 5/5] ovl: don't require "metacopy=on" for "verity" Miklos Szeredi
2025-03-25 11:33   ` Amir Goldstein
2025-03-25 11:47     ` Amir Goldstein
2025-03-25 13:42       ` Alexander Larsson
2025-03-26 10:24     ` Miklos Szeredi
2025-03-28 10:08       ` Alexander Larsson
2025-03-25 13:48   ` Alexander Larsson
2025-03-25 12:04 ` [PATCH v2 0/5] ovl: metacopy/verity fixes and improvements Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250325104634.162496-2-mszeredi@redhat.com \
    --to=mszeredi@redhat.com \
    --cc=alexl@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=gscrivan@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).