mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
samples/kretprobes: Fix return value if register_kretprobe() failed
[ Upstream commitf76fbbbb50
] 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:804defea1c
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5ee20e812a
commit
50d9b55d71
1 changed files with 1 additions and 1 deletions
|
@ -83,7 +83,7 @@ static int __init kretprobe_init(void)
|
||||||
ret = register_kretprobe(&my_kretprobe);
|
ret = register_kretprobe(&my_kretprobe);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("register_kretprobe failed, returned %d\n", ret);
|
pr_err("register_kretprobe failed, returned %d\n", ret);
|
||||||
return -1;
|
return ret;
|
||||||
}
|
}
|
||||||
pr_info("Planted return probe at %s: %p\n",
|
pr_info("Planted return probe at %s: %p\n",
|
||||||
my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
|
my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
|
||||||
|
|
Loading…
Reference in a new issue