On Wed, Feb 22, 2023 at 03:35:28PM +0100, Viktor Malik wrote: SNIP > diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c > index d0ed7d6f5eec..ebb20bf252c7 100644 > --- a/kernel/bpf/trampoline.c > +++ b/kernel/bpf/trampoline.c > @@ -172,26 +172,6 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key) > return tr; > } > nit, I think we can now remove linux/module.h include jirka > -static int bpf_trampoline_module_get(struct bpf_trampoline *tr) > -{ > - struct module *mod; > - int err = 0; > - > - preempt_disable(); > - mod = __module_text_address((unsigned long) tr->func.addr); > - if (mod && !try_module_get(mod)) > - err = -ENOENT; > - preempt_enable(); > - tr->mod = mod; > - return err; > -} > - > -static void bpf_trampoline_module_put(struct bpf_trampoline *tr) > -{ > - module_put(tr->mod); > - tr->mod = NULL; > -} > - > static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr) > { > void *ip = tr->func.addr; > @@ -202,8 +182,6 @@ static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr) > else > ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, old_addr, NULL); > > - if (!ret) > - bpf_trampoline_module_put(tr); > return ret; > } > > @@ -238,9 +216,6 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr) > tr->func.ftrace_managed = true; > } > > - if (bpf_trampoline_module_get(tr)) > - return -ENOENT; > - > if (tr->func.ftrace_managed) { > ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1); > ret = register_ftrace_direct_multi(tr->fops, (long)new_addr); > @@ -248,8 +223,6 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr) > ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, NULL, new_addr); > } > > - if (ret) > - bpf_trampoline_module_put(tr); > return ret; > } > SNIP