Skip to content

Commit 72f098f

Browse files
committed
ovl: port ovl_copy_up_tmpfile() to cred guard
Remove the complicated struct ovl_cu_creds dance and use our new copy up cred guard. Link: https://patch.msgid.link/20251114-work-ovl-cred-guard-copyup-v1-4-ea3fb15cf427@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 643b8a2 commit 72f098f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fs/overlayfs/copy_up.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -883,17 +883,17 @@ static int ovl_copy_up_tmpfile(struct ovl_copy_up_ctx *c)
883883
struct inode *udir = d_inode(c->destdir);
884884
struct dentry *temp, *upper;
885885
struct file *tmpfile;
886-
struct ovl_cu_creds cc;
887886
int err;
888887

889-
err = ovl_prep_cu_creds(c->dentry, &cc);
890-
if (err)
891-
return err;
888+
scoped_class(copy_up_creds, copy_up_creds, c->dentry) {
889+
if (IS_ERR(copy_up_creds))
890+
return PTR_ERR(copy_up_creds);
891+
892+
ovl_start_write(c->dentry);
893+
tmpfile = ovl_do_tmpfile(ofs, c->workdir, c->stat.mode);
894+
ovl_end_write(c->dentry);
895+
}
892896

893-
ovl_start_write(c->dentry);
894-
tmpfile = ovl_do_tmpfile(ofs, c->workdir, c->stat.mode);
895-
ovl_end_write(c->dentry);
896-
ovl_revert_cu_creds(&cc);
897897
if (IS_ERR(tmpfile))
898898
return PTR_ERR(tmpfile);
899899

0 commit comments

Comments
 (0)