Message ID | 20240705-fix-wq-v1-1-91b4d82cd825@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | f56f4d541eab1ae060a46b56dd6ec9130d6e3a98 |
Headers | show |
Series | Small API fix for bpf_wq | expand |
On Fri, 2024-07-05 at 15:44 +0200, Benjamin Tissoires wrote: > 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> > --- Reviewed-by: Eduard Zingerman <eddyz87@gmail.com>
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 229396172026..5241ba671c5a 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -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) {
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> --- kernel/bpf/helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)