@@ -944,7 +944,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
} else
ret = assign_fw(fw, device);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
put_cred(kern_cred);
out:
@@ -249,7 +249,7 @@ static struct file *open_file_as_root(const char *filename, int flags, umode_t m
fp = file_open_root(&root, filename, flags, mode);
path_put(&root);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
return fp;
}
@@ -3758,7 +3758,7 @@ static int __init target_core_init_configfs(void)
}
old_cred = override_creds_light(get_new_cred(kern_cred));
target_init_dbroot();
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
put_cred(kern_cred);
return 0;
@@ -1642,7 +1642,7 @@ static void aio_fsync_work(struct work_struct *work)
const struct cred *old_cred = override_creds_light(get_new_cred(iocb->fsync.creds));
iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
put_cred(iocb->fsync.creds);
iocb_put(iocb);
}
@@ -828,7 +828,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
*/
old_cred = override_creds_light(get_new_cred(file->f_cred));
f = open_exec(e->interpreter);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
if (IS_ERR(f)) {
pr_notice("register: failed to install interpreter file %s\n",
e->interpreter);
@@ -399,7 +399,7 @@ static inline void cachefiles_begin_secure(struct cachefiles_cache *cache,
static inline void cachefiles_end_secure(struct cachefiles_cache *cache,
const struct cred *saved_cred)
{
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
}
/*
@@ -781,7 +781,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
kfree(argv);
kfree(cn.corename);
coredump_finish(core_dumped);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
fail_creds:
put_cred(cred);
fail:
@@ -381,7 +381,7 @@ static void nfs_local_call_read(struct work_struct *work)
nfs_local_read_done(iocb, status);
nfs_local_pgio_release(iocb);
- revert_creds(save_cred);
+ put_cred(revert_creds_light(save_cred));
}
static int
@@ -554,7 +554,7 @@ static void nfs_local_call_write(struct work_struct *work)
nfs_local_vfs_getattr(iocb);
nfs_local_pgio_release(iocb);
- revert_creds(save_cred);
+ put_cred(revert_creds_light(save_cred));
current->flags = old_flags;
}
@@ -313,7 +313,7 @@ static ssize_t nfs_idmap_get_key(const char *name, size_t namelen,
saved_cred = override_creds_light(get_new_cred(id_resolver_cache));
rkey = nfs_idmap_request_key(name, namelen, type, idmap);
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
if (IS_ERR(rkey)) {
ret = PTR_ERR(rkey);
@@ -27,7 +27,7 @@ int nfsd_setuser(struct svc_cred *cred, struct svc_export *exp)
int flags = nfsexp_flags(cred, exp);
/* discard any old override before preparing the new set */
- revert_creds(get_cred(current_real_cred()));
+ put_cred(revert_creds_light(get_cred(current_real_cred())));
new = prepare_creds();
if (!new)
return -ENOMEM;
@@ -1252,7 +1252,7 @@ nfsd_file_acquire_local(struct net *net, struct svc_cred *cred,
beres = nfsd_file_do_acquire(NULL, net, cred, client,
fhp, may_flags, NULL, pnf, true);
- revert_creds(save_cred);
+ put_cred(revert_creds_light(save_cred));
return beres;
}
@@ -89,7 +89,7 @@ nfs4_save_creds(const struct cred **original_creds)
static void
nfs4_reset_creds(const struct cred *original)
{
- revert_creds(original);
+ put_cred(revert_creds_light(original));
}
static void
@@ -523,7 +523,7 @@ static long do_faccessat(int dfd, const char __user *filename, int mode, int fla
}
out:
if (old_cred)
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
return res;
}
@@ -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) {
- revert_creds(cc->old);
+ put_cred(revert_creds_light(cc->old));
put_cred(cc->new);
}
}
@@ -175,7 +175,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo,
cifs_dbg(FYI, "key description = %s\n", description);
saved_cred = override_creds_light(get_new_cred(spnego_cred));
spnego_key = request_key(&cifs_spnego_key_type, description, "");
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
#ifdef CONFIG_CIFS_DEBUG2
if (cifsFYI && !IS_ERR(spnego_key)) {
@@ -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:
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
return rc;
invalidate_key:
@@ -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:
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
kfree(sidstr);
/*
@@ -800,7 +800,7 @@ void ksmbd_revert_fsids(struct ksmbd_work *work)
WARN_ON(!work->saved_cred);
cred = current_cred();
- revert_creds(work->saved_cred);
+ put_cred(revert_creds_light(work->saved_cred));
put_cred(cred);
work->saved_cred = NULL;
}
@@ -1715,7 +1715,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
audit_uring_exit(!ret, ret);
if (creds)
- revert_creds(creds);
+ put_cred(revert_creds_light(creds));
if (ret == IOU_OK) {
if (issue_flags & IO_URING_F_COMPLETE_DEFER)
@@ -192,7 +192,7 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries)
if (to_submit && wq_has_sleeper(&ctx->sqo_sq_wait))
wake_up(&ctx->sqo_sq_wait);
if (creds)
- revert_creds(creds);
+ put_cred(revert_creds_light(creds));
}
return ret;
@@ -541,7 +541,7 @@ static void do_acct_process(struct bsd_acct_struct *acct)
}
out:
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
- revert_creds(orig_cred);
+ put_cred(revert_creds_light(orig_cred));
}
/**
@@ -5220,7 +5220,7 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
of->file->f_path.dentry->d_sb,
threadgroup, ctx->ns);
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
if (ret)
goto out_finish;
@@ -1476,7 +1476,7 @@ static int user_event_set_call_visible(struct user_event *user, bool visible)
else
ret = trace_remove_event_call(&user->call);
- revert_creds(old_cred);
+ put_cred(revert_creds_light(old_cred));
put_cred(cred);
return ret;
@@ -126,7 +126,7 @@ int dns_query(struct net *net,
*/
saved_cred = override_creds_light(get_new_cred(dns_resolver_cache));
rkey = request_key_net(&key_type_dns_resolver, desc, net, options);
- revert_creds(saved_cred);
+ put_cred(revert_creds_light(saved_cred));
kfree(desc);
if (IS_ERR(rkey)) {
ret = PTR_ERR(rkey);
Convert all calls to revert_creds() over to explicitly dropping reference counts in preparation for converting revert_creds() to revert_creds_light() semantics. Signed-off-by: Christian Brauner <brauner@kernel.org> --- drivers/base/firmware_loader/main.c | 2 +- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/target/target_core_configfs.c | 2 +- fs/aio.c | 2 +- fs/binfmt_misc.c | 2 +- fs/cachefiles/internal.h | 2 +- fs/coredump.c | 2 +- fs/nfs/localio.c | 4 ++-- fs/nfs/nfs4idmap.c | 2 +- fs/nfsd/auth.c | 2 +- fs/nfsd/filecache.c | 2 +- fs/nfsd/nfs4recover.c | 2 +- fs/open.c | 2 +- fs/overlayfs/copy_up.c | 2 +- fs/smb/client/cifs_spnego.c | 2 +- fs/smb/client/cifsacl.c | 4 ++-- fs/smb/server/smb_common.c | 2 +- io_uring/io_uring.c | 2 +- io_uring/sqpoll.c | 2 +- kernel/acct.c | 2 +- kernel/cgroup/cgroup.c | 2 +- kernel/trace/trace_events_user.c | 2 +- net/dns_resolver/dns_query.c | 2 +- 23 files changed, 25 insertions(+), 25 deletions(-)