]> git.baikalelectronics.ru Git - kernel.git/commit
rtla: Fix segmentation fault when failing to enable -t
authorDaniel Bristot de Oliveira <bristot@kernel.org>
Tue, 8 Feb 2022 14:36:21 +0000 (15:36 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 8 Feb 2022 16:23:09 +0000 (11:23 -0500)
commitcec244b5fc4f1f67c1fae8aaaed6f3914bbe4f43
tree78568037a2df723110f8b7357c6e685014dc60a4
parent8ace63d0a6e1d3126e99c54b041421d13dbb7851
rtla: Fix segmentation fault when failing to enable -t

rtla osnoise and timerlat are 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.

Make osnoise_destroy_tool() aware of possible NULL osnoise_tool *,
and do not attempt to destroy it. This also simplifies the exit code.

Link: https://lkml.kernel.org/r/5660a2b6bf66c2655842360f2d7f6b48db5dba23.1644327249.git.bristot@kernel.org
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: 7a1107ec6bab ("rtla/osnoise: Add osnoise top mode")
Fixes: 160a65cc6c00 ("rtla/osnoise: Add the hist mode")
Fixes: 06eb05b5c5af ("rtla: Add timerlat tool and timelart top mode")
Fixes: 19b187440523 ("rtla/timerlat: Add timerlat hist mode")
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
tools/tracing/rtla/src/osnoise.c
tools/tracing/rtla/src/osnoise_hist.c
tools/tracing/rtla/src/osnoise_top.c
tools/tracing/rtla/src/timerlat_hist.c
tools/tracing/rtla/src/timerlat_top.c