summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Lairson Costa <wander@redhat.com>2026-03-09 16:46:22 -0300
committerTomas Glozar <tglozar@redhat.com>2026-03-11 15:29:50 +0100
commitd847188bb92b14518a04d7542e44928a22060847 (patch)
tree52a60fd57d7c6cc3455992d97e9f6ff3fa03033c
parentd6515424e80583928ec1c55e9dd4e906bc90d9be (diff)
rtla: Handle pthread_create() failure properly
Add proper error handling when pthread_create() fails to create the timerlat user-space dispatcher thread. Previously, the code only logged an error message but continued execution, which could lead to undefined behavior when the tool later expects the thread to be running. When pthread_create() returns an error, the function now jumps to the out_trace error path to properly clean up resources and exit. This ensures consistent error handling and prevents the tool from running in an invalid state without the required user-space thread. Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260309195040.1019085-10-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
-rw-r--r--tools/tracing/rtla/src/common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
index a00b5e553545..50d8aafdfd3b 100644
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -336,8 +336,10 @@ int run_tool(struct tool_ops *ops, int argc, char *argv[])
params->user.cgroup_name = params->cgroup_name;
retval = pthread_create(&user_thread, NULL, timerlat_u_dispatcher, &params->user);
- if (retval)
+ if (retval) {
err_msg("Error creating timerlat user-space threads\n");
+ goto out_trace;
+ }
}
retval = ops->enable(tool);