Skip to content

Commit 44d00dc

Browse files
mhiramatrostedt
authored andcommitted
tracing/probe: Fix to allow user to enable events on unloaded modules
Fix to allow user to enable probe events on unloaded modules. This operations was allowed before commit 60d53e2 ("tracing/probe: Split trace_event related data from trace_probe"), because if users need to probe module init functions, they have to enable those probe events before loading module. Link: http://lkml.kernel.org/r/156879693733.31056.9331322616994665167.stgit@devnote2 Cc: [email protected] Fixes: 60d53e2 ("tracing/probe: Split trace_event related data from trace_probe") Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 604e354 commit 44d00dc

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -371,31 +371,24 @@ static int enable_trace_kprobe(struct trace_event_call *call,
371371
if (enabled)
372372
return 0;
373373

374-
enabled = false;
375374
list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
376375
tk = container_of(pos, struct trace_kprobe, tp);
377376
if (trace_kprobe_has_gone(tk))
378377
continue;
379378
ret = __enable_trace_kprobe(tk);
380-
if (ret) {
381-
if (enabled) {
382-
__disable_trace_kprobe(tp);
383-
enabled = false;
384-
}
379+
if (ret)
385380
break;
386-
}
387381
enabled = true;
388382
}
389383

390-
if (!enabled) {
391-
/* No probe is enabled. Roll back */
384+
if (ret) {
385+
/* Failed to enable one of them. Roll back all */
386+
if (enabled)
387+
__disable_trace_kprobe(tp);
392388
if (file)
393389
trace_probe_remove_file(tp, file);
394390
else
395391
trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
396-
if (!ret)
397-
/* Since all probes are gone, this is not available */
398-
ret = -EADDRNOTAVAIL;
399392
}
400393

401394
return ret;

0 commit comments

Comments
 (0)