@@ -102,7 +102,7 @@ static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image)
return arch_prepare_bpf_dispatcher(image, &ips[0], d->num_progs);
}
-static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs)
+static int bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs)
{
void *old, *new;
u32 noff;
@@ -118,15 +118,17 @@ static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs)
new = d->num_progs ? d->image + noff : NULL;
if (new) {
- if (bpf_dispatcher_prepare(d, new))
- return;
+ err = bpf_dispatcher_prepare(d, new);
+ if (err)
+ return err;
}
err = bpf_arch_text_poke(d->func, BPF_MOD_JUMP, old, new);
if (err || !new)
- return;
+ return err;
d->image_off = noff;
+ return 0;
}
void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,
We don't currently propagate error value from bpf_dispatcher_update function. This will be needed in following patch, that needs to update kallsyms based on the success of dispatcher update. Suggested-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- kernel/bpf/dispatcher.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)