mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
cifs: avoid pointless cred reference count bump
During module init root_cred will be allocated with its own reference which is only destroyed during module exit. Link: https://lore.kernel.org/r/20241125-work-cred-v2-20-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:
parent
6077c4620d
commit
2b315eda9e
@ -292,7 +292,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid)
|
||||
return -EINVAL;
|
||||
|
||||
rc = 0;
|
||||
saved_cred = override_creds(get_new_cred(root_cred));
|
||||
saved_cred = override_creds(root_cred);
|
||||
sidkey = request_key(&cifs_idmap_key_type, desc, "");
|
||||
if (IS_ERR(sidkey)) {
|
||||
rc = -EINVAL;
|
||||
@ -327,7 +327,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid)
|
||||
out_key_put:
|
||||
key_put(sidkey);
|
||||
out_revert_creds:
|
||||
put_cred(revert_creds(saved_cred));
|
||||
revert_creds(saved_cred);
|
||||
return rc;
|
||||
|
||||
invalidate_key:
|
||||
@ -398,7 +398,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
|
||||
if (!sidstr)
|
||||
return -ENOMEM;
|
||||
|
||||
saved_cred = override_creds(get_new_cred(root_cred));
|
||||
saved_cred = override_creds(root_cred);
|
||||
sidkey = request_key(&cifs_idmap_key_type, sidstr, "");
|
||||
if (IS_ERR(sidkey)) {
|
||||
cifs_dbg(FYI, "%s: Can't map SID %s to a %cid\n",
|
||||
@ -438,7 +438,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
|
||||
out_key_put:
|
||||
key_put(sidkey);
|
||||
out_revert_creds:
|
||||
put_cred(revert_creds(saved_cred));
|
||||
revert_creds(saved_cred);
|
||||
kfree(sidstr);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user