mirror of https://github.com/torvalds/linux.git
ovl: port ovl_rename() to cred guard
Use the scoped ovl cred guard. Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-35-b31603935724@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
a1da840198
commit
ca0c657f25
|
|
@ -1319,7 +1319,6 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
|
|||
struct dentry *old, struct inode *newdir,
|
||||
struct dentry *new, unsigned int flags)
|
||||
{
|
||||
const struct cred *old_cred = NULL;
|
||||
struct ovl_renamedata ovlrd = {
|
||||
.old_parent = old->d_parent,
|
||||
.old_dentry = old,
|
||||
|
|
@ -1332,17 +1331,13 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir,
|
|||
int err;
|
||||
|
||||
err = ovl_rename_start(&ovlrd, &list);
|
||||
if (err)
|
||||
goto out;
|
||||
if (!err) {
|
||||
with_ovl_creds(old->d_sb)
|
||||
err = ovl_rename_upper(&ovlrd, &list);
|
||||
ovl_rename_end(&ovlrd);
|
||||
}
|
||||
|
||||
old_cred = ovl_override_creds(old->d_sb);
|
||||
|
||||
err = ovl_rename_upper(&ovlrd, &list);
|
||||
|
||||
ovl_revert_creds(old_cred);
|
||||
ovl_rename_end(&ovlrd);
|
||||
out:
|
||||
dput(ovlrd->opaquedir);
|
||||
dput(ovlrd.opaquedir);
|
||||
ovl_cache_free(&list);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue