]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ovl: port ovl_dir_llseek() to cred guard
authorChristian Brauner <brauner@kernel.org>
Mon, 17 Nov 2025 09:33:57 +0000 (10:33 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 19 Nov 2025 20:58:23 +0000 (21:58 +0100)
Use the scoped ovl cred guard.

Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-26-b31603935724@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/overlayfs/readdir.c

index e285194306cca89ca2c2c5502dbd10a08ba4a52b..28d399de26f3f87e518ce98709fd5616021807a3 100644 (file)
@@ -955,14 +955,8 @@ out_unlock:
 static struct file *ovl_dir_open_realfile(const struct file *file,
                                          const struct path *realpath)
 {
-       struct file *res;
-       const struct cred *old_cred;
-
-       old_cred = ovl_override_creds(file_inode(file)->i_sb);
-       res = ovl_path_open(realpath, O_RDONLY | (file->f_flags & O_LARGEFILE));
-       ovl_revert_creds(old_cred);
-
-       return res;
+       with_ovl_creds(file_inode(file)->i_sb)
+               return ovl_path_open(realpath, O_RDONLY | (file->f_flags & O_LARGEFILE));
 }
 
 /*