1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-11 17:10:13 +00:00

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>
This commit is contained in:
Christian Brauner 2025-11-19 20:27:21 +01:00
parent 81b77b5b0a
commit bdba9c79c8
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -790,7 +790,6 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
struct path path = { .mnt = ovl_upper_mnt(ofs) };
struct renamedata rd = {};
struct dentry *temp;
struct ovl_cu_creds cc;
int err;
struct ovl_cattr cattr = {
/* 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)
.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);
ovl_start_write(c->dentry);
temp = ovl_create_temp(ofs, c->workdir, &cattr);
ovl_end_write(c->dentry);
}
if (IS_ERR(temp))
return PTR_ERR(temp);