]> git.baikalelectronics.ru Git - kernel.git/commit
samples/kretprobes: Fix return value if register_kretprobe() failed
authorTiezhu Yang <yangtiezhu@loongson.cn>
Tue, 26 Oct 2021 01:51:28 +0000 (09:51 +0800)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 26 Oct 2021 21:23:46 +0000 (17:23 -0400)
commit7b31220c5cb650cf16071f0565b1e543a1b8f676
tree2c783bad58bf41d35ca95416df860fb76044b181
parent9ec28bb8e6c9ec338216c7ab2efc2a81f80989a7
samples/kretprobes: Fix return value if register_kretprobe() failed

Use the actual return value instead of always -1 if register_kretprobe()
failed.

E.g. without this patch:

 # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
 insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted

With this patch:

 # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
 insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module

Link: https://lkml.kernel.org/r/1635213091-24387-2-git-send-email-yangtiezhu@loongson.cn
Fixes: 2fa9d79d1645 ("Kprobes: move kprobe examples to samples/")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
samples/kprobes/kretprobe_example.c