diff mbox series

[v2,25/29] trace: avoid pointless cred reference count bump

Message ID 20241125-work-cred-v2-25-68b9d38bb5b2@kernel.org (mailing list archive)
State New
Headers show
Series cred: rework {override,revert}_creds() | expand

Commit Message

Christian Brauner Nov. 25, 2024, 2:10 p.m. UTC
The creds are allocated via prepare_creds() which has already taken a
reference.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 kernel/trace/trace_events_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index c54ae15f425c2c1dad3f8c776027beca2f00a0a5..17bcad8f79de70a29fb58f84ce12ffb929515794 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1469,14 +1469,14 @@  static int user_event_set_call_visible(struct user_event *user, bool visible)
 	 */
 	cred->fsuid = GLOBAL_ROOT_UID;
 
-	old_cred = override_creds(get_new_cred(cred));
+	old_cred = override_creds(cred);
 
 	if (visible)
 		ret = trace_add_event_call(&user->call);
 	else
 		ret = trace_remove_event_call(&user->call);
 
-	put_cred(revert_creds(old_cred));
+	revert_creds(old_cred);
 	put_cred(cred);
 
 	return ret;