Skip to content

Commit caf6bf4

Browse files
committed
binfmt_misc: avoid pointless cred reference count bump
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 b37eab4 commit caf6bf4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/binfmt_misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,9 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
829829
* didn't matter much as only a privileged process could open
830830
* the register file.
831831
*/
832-
old_cred = override_creds(get_new_cred(file->f_cred));
832+
old_cred = override_creds(file->f_cred);
833833
f = open_exec(e->interpreter);
834-
put_cred(revert_creds(old_cred));
834+
revert_creds(old_cred);
835835
if (IS_ERR(f)) {
836836
pr_notice("register: failed to install interpreter file %s\n",
837837
e->interpreter);

0 commit comments

Comments
 (0)