Commit 927d6874 authored by Oleg Nesterov's avatar Oleg Nesterov

uprobes/tracing: Fix uprobe_perf_open() on uprobe_apply() failure

uprobe_perf_open()->uprobe_apply() can fail, but this error is wrongly
ignored. Change uprobe_perf_open() to do uprobe_perf_close() and return
the error code in this case.

Change uprobe_perf_close() to propogate the error from uprobe_apply()
as well, although it should not fail.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Acked-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
parent ce5f36a5
...@@ -1026,7 +1026,7 @@ static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event) ...@@ -1026,7 +1026,7 @@ static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event)
write_unlock(&tu->filter.rwlock); write_unlock(&tu->filter.rwlock);
if (!done) if (!done)
uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); return uprobe_apply(tu->inode, tu->offset, &tu->consumer, false);
return 0; return 0;
} }
...@@ -1034,6 +1034,7 @@ static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event) ...@@ -1034,6 +1034,7 @@ static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event)
static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event)
{ {
bool done; bool done;
int err;
write_lock(&tu->filter.rwlock); write_lock(&tu->filter.rwlock);
if (event->hw.tp_target) { if (event->hw.tp_target) {
...@@ -1055,10 +1056,13 @@ static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) ...@@ -1055,10 +1056,13 @@ static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event)
} }
write_unlock(&tu->filter.rwlock); write_unlock(&tu->filter.rwlock);
if (!done) err = 0;
uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); if (!done) {
err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true);
return 0; if (err)
uprobe_perf_close(tu, event);
}
return err;
} }
static bool uprobe_perf_filter(struct uprobe_consumer *uc, static bool uprobe_perf_filter(struct uprobe_consumer *uc,
......
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