lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/8] rtla/osnoise_top: Fix segmentation fault when failing to enable -t
Date
rtla osnoise top is causing a segmentation fault when running with
the --trace option on a kernel that does not support multiple
instances. For example:

[root@f34 rtla]# rtla osnoise top -t
failed to enable the tracer osnoise
Could not enable osnoiser tracer for tracing
Failed to enable the trace instance
Segmentation fault (core dumped)

This error happens because the exit code of the tools is trying
to destroy the trace instance that failed to be created.

Rearrange the order in which trace instances are destroyed to avoid
this problem.

Fixes: 1eceb2fc2ca5 ("rtla/osnoise: Add osnoise top mode")
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
tools/tracing/rtla/src/osnoise_top.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 332b2ac205fc..546769bc7ff7 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -546,7 +546,7 @@ int osnoise_top_main(int argc, char **argv)
trace);
if (retval < 0) {
err_msg("Error iterating on events\n");
- goto out_top;
+ goto out_trace;
}

if (!params->quiet)
@@ -569,11 +569,12 @@ int osnoise_top_main(int argc, char **argv)
}
}

+out_trace:
+ if (params->trace_output)
+ osnoise_destroy_tool(record);
out_top:
osnoise_free_top(tool->data);
osnoise_destroy_tool(tool);
- if (params->trace_output)
- osnoise_destroy_tool(record);
out_exit:
exit(return_value);
}
--
2.34.1
\
 
 \ /
  Last update: 2022-01-24 15:25    [W:0.058 / U:27.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site