Merge tag 'devicetree-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / bpf / bpf_iter.c
index 2d4fbdb..b2ee450 100644 (file)
@@ -360,6 +360,28 @@ bool bpf_iter_prog_supported(struct bpf_prog *prog)
        return supported;
 }
 
+const struct bpf_func_proto *
+bpf_iter_get_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
+{
+       const struct bpf_iter_target_info *tinfo;
+       const struct bpf_func_proto *fn = NULL;
+
+       mutex_lock(&targets_mutex);
+       list_for_each_entry(tinfo, &targets, list) {
+               if (tinfo->btf_id == prog->aux->attach_btf_id) {
+                       const struct bpf_iter_reg *reg_info;
+
+                       reg_info = tinfo->reg_info;
+                       if (reg_info->get_func_proto)
+                               fn = reg_info->get_func_proto(func_id, prog);
+                       break;
+               }
+       }
+       mutex_unlock(&targets_mutex);
+
+       return fn;
+}
+
 static void bpf_iter_link_release(struct bpf_link *link)
 {
        struct bpf_iter_link *iter_link =
@@ -664,7 +686,7 @@ int bpf_iter_run_prog(struct bpf_prog *prog, void *ctx)
 
        rcu_read_lock();
        migrate_disable();
-       ret = BPF_PROG_RUN(prog, ctx);
+       ret = bpf_prog_run(prog, ctx);
        migrate_enable();
        rcu_read_unlock();