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

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

index 53cabd948968f8ab91a70ea3b11d694b90b20241..a3a4924874d28e21f5f8624e758610195cbf769c 100644 (file)
@@ -712,15 +712,13 @@ int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
 {
        struct inode *inode = d_inode(dentry);
        struct path realpath;
-       const struct cred *old_cred;
        int err;
 
        ovl_path_real(dentry, &realpath);
 
-       old_cred = ovl_override_creds(inode->i_sb);
-       err = ovl_real_fileattr_get(&realpath, fa);
+       with_ovl_creds(inode->i_sb)
+               err = ovl_real_fileattr_get(&realpath, fa);
        ovl_fileattr_prot_flags(inode, fa);
-       ovl_revert_creds(old_cred);
 
        return err;
 }