Skip to content

Commit bdba9c7

Browse files
committed
ovl: port ovl_copy_up_workdir() 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-2-ea3fb15cf427@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 81b77b5 commit bdba9c7

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

fs/overlayfs/copy_up.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
790790
struct path path = { .mnt = ovl_upper_mnt(ofs) };
791791
struct renamedata rd = {};
792792
struct dentry *temp;
793-
struct ovl_cu_creds cc;
794793
int err;
795794
struct ovl_cattr cattr = {
796795
/* Can't properly set mode on creation because of the umask */
@@ -799,14 +798,14 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
799798
.link = c->link
800799
};
801800

802-
err = ovl_prep_cu_creds(c->dentry, &cc);
803-
if (err)
804-
return err;
801+
scoped_class(copy_up_creds, copy_up_creds, c->dentry) {
802+
if (IS_ERR(copy_up_creds))
803+
return PTR_ERR(copy_up_creds);
805804

806-
ovl_start_write(c->dentry);
807-
temp = ovl_create_temp(ofs, c->workdir, &cattr);
808-
ovl_end_write(c->dentry);
809-
ovl_revert_cu_creds(&cc);
805+
ovl_start_write(c->dentry);
806+
temp = ovl_create_temp(ofs, c->workdir, &cattr);
807+
ovl_end_write(c->dentry);
808+
}
810809

811810
if (IS_ERR(temp))
812811
return PTR_ERR(temp);

0 commit comments

Comments
 (0)