diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-11-19 20:27:21 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-11-19 21:58:27 +0100 |
| commit | bdba9c79c8ba6d194fb2821f504222e1630d5c5f (patch) | |
| tree | bc7acce484455148b644579e3021f7f01bd95141 /fs/overlayfs | |
| parent | 81b77b5b0a2984e767674c50a35b71ca218da7e7 (diff) | |
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>
Diffstat (limited to 'fs/overlayfs')
| -rw-r--r-- | fs/overlayfs/copy_up.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index a7f70dadf94f..28fdbf131db6 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -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); |