diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-11-17 10:34:09 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-11-19 21:58:25 +0100 |
| commit | 6b6ef7d16fbb63179b33f98b19818d0d2710be64 (patch) | |
| tree | 2ee30903c803efb1b1fdb8c49c615e9c2f642f78 /fs/overlayfs | |
| parent | 15da486ad3bde6119d9b6353bebc2ffb6e9165c1 (diff) | |
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>
Diffstat (limited to 'fs/overlayfs')
| -rw-r--r-- | fs/overlayfs/namei.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 5bed42c079f0..61c2dbd49b6f 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -1376,7 +1376,6 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data 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); - - err = ovl_lookup_layers(&ctx, &d); + with_ovl_creds(dentry->d_sb) + err = ovl_lookup_layers(&ctx, &d); - ovl_revert_creds(old_cred); if (ctx.origin_path) { dput(ctx.origin_path->dentry); kfree(ctx.origin_path); |