mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
cgroup: avoid pointless cred reference count bump
of->file->f_cred already holds a reference count that is stable during the operation. Link: https://lore.kernel.org/r/20241125-work-cred-v2-24-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
6256d2377e
commit
34ab26fb6b
@ -5216,11 +5216,11 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
|
|||||||
* permissions using the credentials from file open to protect against
|
* permissions using the credentials from file open to protect against
|
||||||
* inherited fd attacks.
|
* inherited fd attacks.
|
||||||
*/
|
*/
|
||||||
saved_cred = override_creds(get_new_cred(of->file->f_cred));
|
saved_cred = override_creds(of->file->f_cred);
|
||||||
ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
|
ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
|
||||||
of->file->f_path.dentry->d_sb,
|
of->file->f_path.dentry->d_sb,
|
||||||
threadgroup, ctx->ns);
|
threadgroup, ctx->ns);
|
||||||
put_cred(revert_creds(saved_cred));
|
revert_creds(saved_cred);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_finish;
|
goto out_finish;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user