ovl: avoid pointless cred reference count bump

security_inode_copy_up() allocates a set of new credentials and has
taken a reference count.

Link: https://lore.kernel.org/r/20241125-work-cred-v2-18-68b9d38bb5b2@kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2024-11-25 15:10:14 +01:00
parent 7708f3a7d2
commit facc239a8c
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -741,7 +741,7 @@ static int ovl_prep_cu_creds(struct dentry *dentry, struct ovl_cu_creds *cc)
return err;
if (cc->new)
cc->old = override_creds(get_new_cred(cc->new));
cc->old = override_creds(cc->new);
return 0;
}
@ -749,7 +749,7 @@ static int ovl_prep_cu_creds(struct dentry *dentry, struct ovl_cu_creds *cc)
static void ovl_revert_cu_creds(struct ovl_cu_creds *cc)
{
if (cc->new) {
put_cred(revert_creds(cc->old));
revert_creds(cc->old);
put_cred(cc->new);
}
}