Use the scoped ovl cred guard. Signed-off-by: Christian Brauner --- fs/overlayfs/dir.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index cd2b397d23a0..9d5cea06ca00 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -1247,7 +1247,6 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir, bool overwrite = !(flags & RENAME_EXCHANGE); bool is_dir = d_is_dir(old); bool new_is_dir = d_is_dir(new); - const struct cred *old_cred = NULL; struct ovl_renamedata ovlrd = { .old_parent = old->d_parent, .old_dentry = old, @@ -1318,11 +1317,9 @@ static int ovl_rename(struct mnt_idmap *idmap, struct inode *olddir, goto out; } - old_cred = ovl_override_creds(old->d_sb); - + with_ovl_creds(old->d_sb) err = do_ovl_rename(&ovlrd, &list); - ovl_revert_creds(old_cred); if (update_nlink) ovl_nlink_end(new); else -- 2.47.3