summaryrefslogtreecommitdiff
path: root/kernel/bpf/dispatcher.c
diff options
context:
space:
mode:
authorSong Liu <song@kernel.org>2023-12-06 14:40:48 -0800
committerAlexei Starovoitov <ast@kernel.org>2023-12-06 17:17:20 -0800
commitf08a1c658257c73697a819c4ded3a84b6f0ead74 (patch)
tree447d1a173b1f692cb45d232801e1d855adf315fc /kernel/bpf/dispatcher.c
parent7065eefb38f16c91e9ace36fb7c873e4c9857c27 (diff)
bpf: Let bpf_prog_pack_free handle any pointer
Currently, bpf_prog_pack_free only can only free pointer to struct bpf_binary_header, which is not flexible. Add a size argument to bpf_prog_pack_free so that it can handle any pointer. Signed-off-by: Song Liu <song@kernel.org> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> # on s390x Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20231206224054.492250-2-song@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/dispatcher.c')
-rw-r--r--kernel/bpf/dispatcher.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/bpf/dispatcher.c b/kernel/bpf/dispatcher.c
index fa3e9225aedc..56760fc10e78 100644
--- a/kernel/bpf/dispatcher.c
+++ b/kernel/bpf/dispatcher.c
@@ -150,10 +150,7 @@ void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,
goto out;
d->rw_image = bpf_jit_alloc_exec(PAGE_SIZE);
if (!d->rw_image) {
- u32 size = PAGE_SIZE;
-
- bpf_arch_text_copy(d->image, &size, sizeof(size));
- bpf_prog_pack_free((struct bpf_binary_header *)d->image);
+ bpf_prog_pack_free(d->image, PAGE_SIZE);
d->image = NULL;
goto out;
}