mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
ovl: port ovl_fill_super() to cred guard
Use the scoped ovl cred guard. Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-41-b31603935724@kernel.org Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
fc95cda673
commit
217e78d1b7
|
|
@ -1540,8 +1540,6 @@ static int ovl_fill_super_creds(struct fs_context *fc, struct super_block *sb)
|
|||
int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
|
||||
{
|
||||
struct ovl_fs *ofs = sb->s_fs_info;
|
||||
const struct cred *old_cred = NULL;
|
||||
struct cred *cred;
|
||||
int err;
|
||||
|
||||
err = -EIO;
|
||||
|
|
@ -1550,19 +1548,15 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
|
|||
|
||||
ovl_set_d_op(sb);
|
||||
|
||||
err = -ENOMEM;
|
||||
if (!ofs->creator_cred)
|
||||
ofs->creator_cred = cred = prepare_creds();
|
||||
else
|
||||
cred = (struct cred *)ofs->creator_cred;
|
||||
if (!cred)
|
||||
goto out_err;
|
||||
if (!ofs->creator_cred) {
|
||||
err = -ENOMEM;
|
||||
ofs->creator_cred = prepare_creds();
|
||||
if (!ofs->creator_cred)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
old_cred = ovl_override_creds(sb);
|
||||
|
||||
err = ovl_fill_super_creds(fc, sb);
|
||||
|
||||
ovl_revert_creds(old_cred);
|
||||
with_ovl_creds(sb)
|
||||
err = ovl_fill_super_creds(fc, sb);
|
||||
|
||||
out_err:
|
||||
if (err) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user