Thread (15 messages) 15 messages, 2 authors, 2025-11-03
STALE220d

[PATCH 11/12] trace: use prepare credential guard

From: Christian Brauner <brauner@kernel.org>
Date: 2025-11-03 14:58:27
Also in: cgroups, linux-cifs, linux-crypto, linux-fsdevel, linux-nfs, linux-unionfs, lkml, netdev
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

Use the prepare credential guard for allocating a new set of
credentials.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 kernel/trace/trace_events_user.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index c428dafe7496..3461b1d29276 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1453,8 +1453,7 @@ static int user_event_set_call_visible(struct user_event *user, bool visible)
 	const struct cred *old_cred;
 	struct cred *cred;
 
-	cred = prepare_creds();
-
+	CLASS(prepare_creds, cred)();
 	if (!cred)
 		return -ENOMEM;
 
@@ -1477,7 +1476,6 @@ static int user_event_set_call_visible(struct user_event *user, bool visible)
 		ret = trace_remove_event_call(&user->call);
 
 	revert_creds(old_cred);
-	put_cred(cred);
 
 	return ret;
 }
-- 
2.47.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help