Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Wander Lairson Costa and committed by
Tomas Glozar
d847188b d6515424

+3 -1
+3 -1
tools/tracing/rtla/src/common.c
··· 336 336 params->user.cgroup_name = params->cgroup_name; 337 337 338 338 retval = pthread_create(&user_thread, NULL, timerlat_u_dispatcher, &params->user); 339 - if (retval) 339 + if (retval) { 340 340 err_msg("Error creating timerlat user-space threads\n"); 341 + goto out_trace; 342 + } 341 343 } 342 344 343 345 retval = ops->enable(tool);