Skip to content

Commit 6b6ef7d

Browse files
committed
ovl: port ovl_lookup() to cred guard
Use the scoped ovl cred guard. Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-38-b31603935724@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 15da486 commit 6b6ef7d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

fs/overlayfs/namei.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,6 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
13761376
struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
13771377
unsigned int flags)
13781378
{
1379-
const struct cred *old_cred;
13801379
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
13811380
struct ovl_entry *poe = OVL_E(dentry->d_parent);
13821381
bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer);
@@ -1394,11 +1393,9 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
13941393
if (dentry->d_name.len > ofs->namelen)
13951394
return ERR_PTR(-ENAMETOOLONG);
13961395

1397-
old_cred = ovl_override_creds(dentry->d_sb);
1398-
1399-
err = ovl_lookup_layers(&ctx, &d);
1396+
with_ovl_creds(dentry->d_sb)
1397+
err = ovl_lookup_layers(&ctx, &d);
14001398

1401-
ovl_revert_creds(old_cred);
14021399
if (ctx.origin_path) {
14031400
dput(ctx.origin_path->dentry);
14041401
kfree(ctx.origin_path);

0 commit comments

Comments
 (0)