diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-11-17 10:33:43 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-11-19 21:58:21 +0100 |
| commit | 9763970984511861505a88b038dbee2c8c5e1623 (patch) | |
| tree | bbce8abec03c4bf24f5df3a99a29159b4927a4e0 /fs/overlayfs | |
| parent | 8e8f4df93c1d32e57e3d6cb7ac8233c959423597 (diff) | |
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>
Diffstat (limited to 'fs/overlayfs')
| -rw-r--r-- | fs/overlayfs/file.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 73c805851e58..0ab846d8062e 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -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; |