summaryrefslogtreecommitdiff
path: root/kernel/trace
diff options
context:
space:
mode:
authorLi Huafei <lihuafei1@huawei.com>2021-09-24 10:54:48 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-26 13:39:47 +0200
commit6cfbbb961bb94de85455fe35140b1350c7ccb76c (patch)
tree562d7ecf04971d9d0a1d03f807f01e699347bceb /kernel/trace
parent320dc471c471500d61c98380395f8f54aa4add7f (diff)
tracing/kprobe: Fix kprobe_on_func_entry() modification
The commit 960434acef37 ("tracing/kprobe: Fix to support kretprobe events on unloaded modules") backport from v5.11, which modifies the return value of kprobe_on_func_entry(). However, there is no adaptation modification in create_trace_kprobe(), resulting in the exact opposite behavior. Now we need to return an error immediately only if kprobe_on_func_entry() returns -EINVAL. Fixes: 960434acef37 ("tracing/kprobe: Fix to support kretprobe events on unloaded modules") Signed-off-by: Li Huafei <lihuafei1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_kprobe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 61eff45653f5..36dfea29d5fa 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -836,8 +836,9 @@ static int create_trace_kprobe(int argc, char **argv)
pr_info("Failed to parse either an address or a symbol.\n");
return ret;
}
+ /* Defer the ENOENT case until register kprobe */
if (offset && is_return &&
- !kprobe_on_func_entry(NULL, symbol, offset)) {
+ kprobe_on_func_entry(NULL, symbol, offset) == -EINVAL) {
pr_info("Given offset is not valid for return probe.\n");
return -EINVAL;
}