Commit 57ea2a34 authored by Artem Savkov's avatar Artem Savkov Committed by Steven Rostedt (VMware)

tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure

If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe
it returns an error, but does not unset the tp flags it set previously.
This results in a probe being considered enabled and failures like being
unable to remove the probe through kprobe_events file since probes_open()
expects every probe to be disabled.


Cc: Ingo Molnar <>
Fixes: 41a7dd42 ("tracing/kprobes: Support ftrace_event_file base multibuffer")
Acked-by: default avatarMasami Hiramatsu <>
Reviewed-by: default avatarJosh Poimboeuf <>
Signed-off-by: default avatarArtem Savkov <>
Signed-off-by: default avatarSteven Rostedt (VMware) <>
parent 82f4f3e6
......@@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
static int
enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
struct event_file_link *link;
int ret = 0;
if (file) {
struct event_file_link *link;
link = kmalloc(sizeof(*link), GFP_KERNEL);
if (!link) {
ret = -ENOMEM;
......@@ -424,6 +423,16 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
ret = enable_kprobe(&tk->;
if (ret) {
if (file) {
tk->tp.flags &= ~TP_FLAG_TRACE;
} else {
tk->tp.flags &= ~TP_FLAG_PROFILE;
return ret;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment