Skip to content

Commit 34ab26f

Browse files
committed
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/[email protected] Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 6256d23 commit 34ab26f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/cgroup/cgroup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5216,11 +5216,11 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
52165216
* permissions using the credentials from file open to protect against
52175217
* inherited fd attacks.
52185218
*/
5219-
saved_cred = override_creds(get_new_cred(of->file->f_cred));
5219+
saved_cred = override_creds(of->file->f_cred);
52205220
ret = cgroup_attach_permissions(src_cgrp, dst_cgrp,
52215221
of->file->f_path.dentry->d_sb,
52225222
threadgroup, ctx->ns);
5223-
put_cred(revert_creds(saved_cred));
5223+
revert_creds(saved_cred);
52245224
if (ret)
52255225
goto out_finish;
52265226

0 commit comments

Comments
 (0)