From: Christian Brauner Date: Mon, 17 Nov 2025 09:33:35 +0000 (+0100) Subject: ovl: port ovl_set_link_redirect() to cred guard X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff4f6e4689e1f4d9870876651841ea7d996862c9;p=thirdparty%2Fkernel%2Flinux.git ovl: port ovl_set_link_redirect() to cred guard 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 Signed-off-by: Christian Brauner --- diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index c3492b040fba9..170f8dbea4ad3 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -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,