]> www.infradead.org Git - nvme.git/commitdiff
bpf: helpers: fix bpf_wq_set_callback_impl signature
authorBenjamin Tissoires <bentiss@kernel.org>
Mon, 8 Jul 2024 09:52:57 +0000 (11:52 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 8 Jul 2024 17:01:48 +0000 (10:01 -0700)
I realized this while having a map containing both a struct bpf_timer and
a struct bpf_wq: the third argument provided to the bpf_wq callback is
not the struct bpf_wq pointer itself, but the pointer to the value in
the map.

Which means that the users need to double cast the provided "value" as
this is not a struct bpf_wq *.

This is a change of API, but there doesn't seem to be much users of bpf_wq
right now, so we should be able to go with this right now.

Fixes: 81f1d7a583fa ("bpf: wq: add bpf_wq_set_callback_impl")
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Link: https://lore.kernel.org/r/20240708-fix-wq-v2-1-667e5c9fbd99@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c

index 229396172026a4ecc035c5fa7fffcbb9ddda24a3..5241ba671c5a3cadf6c92e617a8cb13e806be541 100644 (file)
@@ -2734,7 +2734,7 @@ __bpf_kfunc int bpf_wq_start(struct bpf_wq *wq, unsigned int flags)
 }
 
 __bpf_kfunc int bpf_wq_set_callback_impl(struct bpf_wq *wq,
-                                        int (callback_fn)(void *map, int *key, struct bpf_wq *wq),
+                                        int (callback_fn)(void *map, int *key, void *value),
                                         unsigned int flags,
                                         void *aux__ign)
 {