diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-08-02 09:59:20 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-08-02 09:59:20 +0200 |
commit | 16e0e6a83b778284ae9b3a57003eeea8d8090b55 (patch) | |
tree | 42bf9a711c59549294b2f2125978f5a7095e16c2 /kernel/trace/trace_kprobe.c | |
parent | Merge tag 'perf-core-for-mingo-4.19-20180725' of git://git.kernel.org/pub/scm... (diff) | |
parent | Merge tag 'perf-urgent-for-mingo-4.18-20180730' of git://git.kernel.org/pub/s... (diff) | |
download | linux-16e0e6a83b778284ae9b3a57003eeea8d8090b55.tar.xz linux-16e0e6a83b778284ae9b3a57003eeea8d8090b55.zip |
Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index b37b92e7dbd4..e9d99463e5df 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -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 = NULL; int ret = 0; if (file) { - struct event_file_link *link; - link = kmalloc(sizeof(*link), GFP_KERNEL); if (!link) { ret = -ENOMEM; @@ -424,6 +423,18 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) else ret = enable_kprobe(&tk->rp.kp); } + + if (ret) { + if (file) { + /* Notice the if is true on not WARN() */ + if (!WARN_ON_ONCE(!link)) + list_del_rcu(&link->list); + kfree(link); + tk->tp.flags &= ~TP_FLAG_TRACE; + } else { + tk->tp.flags &= ~TP_FLAG_PROFILE; + } + } out: return ret; } |