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 <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2025-11-17 10:33:33 +01:00
parent 6f5c84162a
commit 87809f12e0

View File

@@ -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;
}