]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ovl: port ovl_maybe_validate_verity() to cred guard
authorChristian Brauner <brauner@kernel.org>
Mon, 17 Nov 2025 09:33:53 +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-22-b31603935724@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/overlayfs/namei.c

index e93bcc5727bcafdc18a499b47a7609fd41ecaec8..dbacf02423cbf9e949e57414c39c23eb9e915b1f 100644 (file)
@@ -979,15 +979,10 @@ static int ovl_maybe_validate_verity(struct dentry *dentry)
                return err;
 
        if (!ovl_test_flag(OVL_VERIFIED_DIGEST, inode)) {
-               const struct cred *old_cred;
-
-               old_cred = ovl_override_creds(dentry->d_sb);
-
-               err = ovl_validate_verity(ofs, &metapath, &datapath);
+               with_ovl_creds(dentry->d_sb)
+                       err = ovl_validate_verity(ofs, &metapath, &datapath);
                if (err == 0)
                        ovl_set_flag(OVL_VERIFIED_DIGEST, inode);
-
-               ovl_revert_creds(old_cred);
        }
 
        ovl_inode_unlock(inode);