ovl: port ovl_flush() to cred guard

Use the scoped ovl cred guard.

Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-12-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:43 +01:00
parent 8e8f4df93c
commit 9763970984
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -618,7 +618,6 @@ static loff_t ovl_remap_file_range(struct file *file_in, loff_t pos_in,
static int ovl_flush(struct file *file, fl_owner_t id)
{
struct file *realfile;
const struct cred *old_cred;
int err = 0;
realfile = ovl_real_file(file);
@ -626,9 +625,8 @@ static int ovl_flush(struct file *file, fl_owner_t id)
return PTR_ERR(realfile);
if (realfile->f_op->flush) {
old_cred = ovl_override_creds(file_inode(file)->i_sb);
err = realfile->f_op->flush(realfile, id);
ovl_revert_creds(old_cred);
with_ovl_creds(file_inode(file)->i_sb)
err = realfile->f_op->flush(realfile, id);
}
return err;