linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	 linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 Christian Brauner <brauner@kernel.org>
Subject: [PATCH 2/5] ovl: port ovl_copy_up_workdir() to cred guard
Date: Fri, 14 Nov 2025 23:45:23 +0100	[thread overview]
Message-ID: <20251114-work-ovl-cred-guard-copyup-v1-2-ea3fb15cf427@kernel.org> (raw)
In-Reply-To: <20251114-work-ovl-cred-guard-copyup-v1-0-ea3fb15cf427@kernel.org>

Remove the complicated struct ovl_cu_creds dance and use our new copy up
cred guard.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/overlayfs/copy_up.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index cc77498fa8ca..665c5f24e228 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -792,7 +792,6 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
 	struct inode *inode;
 	struct path path = { .mnt = ovl_upper_mnt(ofs) };
 	struct dentry *temp, *upper, *trap;
-	struct ovl_cu_creds cc;
 	int err;
 	struct ovl_cattr cattr = {
 		/* Can't properly set mode on creation because of the umask */
@@ -801,14 +800,14 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
 		.link = c->link
 	};
 
-	err = ovl_prep_cu_creds(c->dentry, &cc);
-	if (err)
-		return err;
+	scoped_class(copy_up_creds, copy_up_creds, c->dentry) {
+		if (IS_ERR(copy_up_creds))
+			return PTR_ERR(copy_up_creds);
 
 		ovl_start_write(c->dentry);
 		temp = ovl_create_temp(ofs, c->workdir, &cattr);
 		ovl_end_write(c->dentry);
-	ovl_revert_cu_creds(&cc);
+	}
 
 	if (IS_ERR(temp))
 		return PTR_ERR(temp);

-- 
2.47.3


  parent reply	other threads:[~2025-11-14 22:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 22:45 [PATCH 0/5] ovl: convert copyup credential override to cred guard Christian Brauner
2025-11-14 22:45 ` [PATCH 1/5] ovl: add copy up credential guard Christian Brauner
2025-11-14 22:45 ` Christian Brauner [this message]
2025-11-14 22:45 ` [PATCH 3/5] ovl: mark *_cu_creds() as unused temporarily Christian Brauner
2025-11-14 22:45 ` [PATCH 4/5] ovl: port ovl_copy_up_tmpfile() to cred guard Christian Brauner
2025-11-14 22:45 ` [PATCH 5/5] ovl: remove struct ovl_cu_creds and associated functions Christian Brauner
2025-11-15  8:26 ` [PATCH 0/5] ovl: convert copyup credential override to cred guard 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=20251114-work-ovl-cred-guard-copyup-v1-2-ea3fb15cf427@kernel.org \
    --to=brauner@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=torvalds@linux-foundation.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).