Skip to content

Commit 3e4b933

Browse files
image-dragonKernel Patches Daemon
authored andcommitted
bpf: handle the return of ftrace_set_filter_ip in register_fentry
The error that returned by ftrace_set_filter_ip() in register_fentry() is not handled properly. Just fix it. Fixes: 00963a2 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)") Signed-off-by: Menglong Dong <[email protected]> Acked-by: Song Liu <[email protected]>
1 parent 4d7050b commit 3e4b933

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/bpf/trampoline.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr)
220220
}
221221

222222
if (tr->func.ftrace_managed) {
223-
ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1);
223+
ret = ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1);
224+
if (ret)
225+
return ret;
224226
ret = register_ftrace_direct(tr->fops, (long)new_addr);
225227
} else {
226228
ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, NULL, new_addr);

0 commit comments

Comments
 (0)