* [PATCH] Fix segmentation fault in trace-cmd record on invalid event hooks
@ 2019-10-24 12:41 Slavomir Kaslev
0 siblings, 0 replies; only message in thread
From: Slavomir Kaslev @ 2019-10-24 12:41 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
Currently passing an invalid event hook to trace-cmd record causes a
segmentation fault, e.g.
Invalid hook format 'foobar'
Segmentation fault
Fix this by checking the return value of tracecmd_create_event_hook().
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
---
tracecmd/trace-record.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index c65731f..0596b63 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -4632,6 +4632,8 @@ static void add_hook(struct buffer_instance *instance, const char *arg)
struct hook_list *hook;
hook = tracecmd_create_event_hook(arg);
+ if (!hook)
+ die("Failed to create event hook %s", arg);
hook->instance = instance;
hook->next = hooks;
--
2.20.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-10-24 12:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 12:41 [PATCH] Fix segmentation fault in trace-cmd record on invalid event hooks Slavomir Kaslev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).