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

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

index c3492b040fba90d665462d161fd77f214312fbda..170f8dbea4ad39a07e6dcc1d8740c5db2fdfb1f9 100644 (file)
@@ -731,14 +731,8 @@ static int ovl_symlink(struct mnt_idmap *idmap, struct inode *dir,
 
 static int ovl_set_link_redirect(struct dentry *dentry)
 {
-       const struct cred *old_cred;
-       int err;
-
-       old_cred = ovl_override_creds(dentry->d_sb);
-       err = ovl_set_redirect(dentry, false);
-       ovl_revert_creds(old_cred);
-
-       return err;
+       with_ovl_creds(dentry->d_sb)
+               return ovl_set_redirect(dentry, false);
 }
 
 static int ovl_link(struct dentry *old, struct inode *newdir,