Use the scoped ovl cred guard. Reviewed-by: Amir Goldstein Signed-off-by: Christian Brauner --- fs/overlayfs/namei.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 4368f9f6ff9c..9c0c539b3a37 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -1376,7 +1376,6 @@ static int do_ovl_lookup(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data *d) struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { - const struct cred *old_cred; struct ovl_fs *ofs = OVL_FS(dentry->d_sb); struct ovl_entry *poe = OVL_E(dentry->d_parent); bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer); @@ -1394,11 +1393,9 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, if (dentry->d_name.len > ofs->namelen) return ERR_PTR(-ENAMETOOLONG); - old_cred = ovl_override_creds(dentry->d_sb); - + with_ovl_creds(dentry->d_sb) err = do_ovl_lookup(&ctx, &d); - ovl_revert_creds(old_cred); if (ctx.origin_path) { dput(ctx.origin_path->dentry); kfree(ctx.origin_path); -- 2.47.3