Skip to content

Commit 5c06bc9

Browse files
committed
Merge patch series "ovl: convert to cred guard"
Christian Brauner <brauner@kernel.org> says: This adds an overlayfs specific extension of the cred guard infrastructure I introduced. This allows all of overlayfs to be ported to cred guards. I refactored a few functions to reduce the scope of the cred guard. I think this is beneficial as it's visually very easy to grasp the scope in one go. Lightly tested. * patches from https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-0-b31603935724@kernel.org: (42 commits) ovl: remove ovl_revert_creds() ovl: port ovl_fill_super() to cred guard ovl: refactor ovl_fill_super() ovl: port ovl_lower_positive() to cred guard ovl: port ovl_lookup() to cred guard ovl: refactor ovl_lookup() ovl: port ovl_copyfile() to cred guard ovl: port ovl_rename() to cred guard ovl: refactor ovl_rename() ovl: introduce struct ovl_renamedata ovl: port ovl_listxattr() to cred guard ovl: port ovl_xattr_get() to cred guard ovl: port ovl_xattr_set() to cred guard ovl: port ovl_nlink_end() to cred guard ovl: port ovl_nlink_start() to cred guard ovl: port ovl_check_empty_dir() to cred guard ovl: port ovl_dir_llseek() to cred guard ovl: refactor ovl_iterate() and port to cred guard ovl: don't override credentials for ovl_check_whiteouts() ovl: port ovl_maybe_lookup_lowerdata() to cred guard ... Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-0-b31603935724@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
2 parents 658d132 + 850e325 commit 5c06bc9

10 files changed

Lines changed: 578 additions & 630 deletions

File tree

fs/overlayfs/copy_up.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,6 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
12031203
static int ovl_copy_up_flags(struct dentry *dentry, int flags)
12041204
{
12051205
int err = 0;
1206-
const struct cred *old_cred;
12071206
bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED);
12081207

12091208
/*
@@ -1223,7 +1222,6 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags)
12231222
if (err)
12241223
return err;
12251224

1226-
old_cred = ovl_override_creds(dentry->d_sb);
12271225
while (!err) {
12281226
struct dentry *next;
12291227
struct dentry *parent = NULL;
@@ -1243,12 +1241,12 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags)
12431241
next = parent;
12441242
}
12451243

1246-
err = ovl_copy_up_one(parent, next, flags);
1244+
with_ovl_creds(dentry->d_sb)
1245+
err = ovl_copy_up_one(parent, next, flags);
12471246

12481247
dput(parent);
12491248
dput(next);
12501249
}
1251-
ovl_revert_creds(old_cred);
12521250

12531251
return err;
12541252
}

0 commit comments

Comments
 (0)