On Oct 27, 2025, at 1:48 AM, Jiri Olsa olsajiri@gmail.com wrote:
[…]
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 5949095e51c3..f2cb0b097093 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -479,11 +479,6 @@ static int bpf_trampoline_update(struct bpf_trampoline *tr, bool lock_direct_mut
- BPF_TRAMP_F_SHARE_IPMODIFY is set, we can generate the
- trampoline again, and retry register.
*/
- /* reset fops->func and fops->trampoline for re-register */
- tr->fops->func = NULL;
- tr->fops->trampoline = 0;
- /* free im memory and reallocate later */
bpf_tramp_image_free(im); goto again; } diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 42bd2ba68a82..725c224fb4e6 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6048,6 +6048,12 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr) ops->direct_call = addr;
err = register_ftrace_function_nolock(ops);
- if (err) {
- /* cleanup for possible another register call */
- ops->func = NULL;
- ops->trampoline = 0;
nit, we could cleanup also flags and direct_call just to be complete, but at the same time it does not seem to affect anything
I actually thought about this and decided to use the same logic as unregister_ftrace_direct().
Thanks, Song