ovl: port ovl_fadvise() to cred guard

Use the scoped ovl cred guard.

Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-11-b31603935724@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2025-11-17 10:33:42 +01:00
parent 2468017783
commit 8e8f4df93c

View File

@@ -508,18 +508,13 @@ out_unlock:
static int ovl_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
{
struct file *realfile;
const struct cred *old_cred;
int ret;
realfile = ovl_real_file(file);
if (IS_ERR(realfile))
return PTR_ERR(realfile);
old_cred = ovl_override_creds(file_inode(file)->i_sb);
ret = vfs_fadvise(realfile, offset, len, advice);
ovl_revert_creds(old_cred);
return ret;
with_ovl_creds(file_inode(file)->i_sb)
return vfs_fadvise(realfile, offset, len, advice);
}
enum ovl_copyop {