From: Christian Brauner Date: Mon, 17 Nov 2025 09:33:33 +0000 (+0100) Subject: ovl: port ovl_copy_up_flags() to cred guards X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87809f12e057dbd482dc9810d0ad194cdca3d71d;p=thirdparty%2Fkernel%2Flinux.git ovl: port ovl_copy_up_flags() to cred guards Use the scoped ovl cred guard. Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-2-b31603935724@kernel.org Reviewed-by: Amir Goldstein Signed-off-by: Christian Brauner --- diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 23216ed013256..859e75daff8e4 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -1203,7 +1203,6 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, static int ovl_copy_up_flags(struct dentry *dentry, int flags) { int err = 0; - const struct cred *old_cred; bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED); /* @@ -1223,7 +1222,6 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags) if (err) return err; - old_cred = ovl_override_creds(dentry->d_sb); while (!err) { struct dentry *next; struct dentry *parent = NULL; @@ -1243,12 +1241,12 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags) next = parent; } - err = ovl_copy_up_one(parent, next, flags); + with_ovl_creds(dentry->d_sb) + err = ovl_copy_up_one(parent, next, flags); dput(parent); dput(next); } - ovl_revert_creds(old_cred); return err; }