summaryrefslogtreecommitdiff
path: root/kernel/bpf
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-02-04 18:14:26 -0800
committerAlexei Starovoitov <ast@kernel.org>2026-02-04 18:14:26 -0800
commit75cd3beb64d0977009e3d1a2d0c03715d3e5e156 (patch)
tree303cdfc5cc1121aed84878e6c6c9b8b4e0ffb286 /kernel/bpf
parent6e951a9b1af5dc063dfe9e17ca433be099527c43 (diff)
parent5000a097f82c7695b7760c5b67c95f0eab4d209b (diff)
Merge branch 'fix-for-bpf_wq-retry-loop-during-free'
Kumar Kartikeya Dwivedi says: ==================== Fix for bpf_wq retry loop during free Small fix and improvement to ensure cancel_work() can handle the case where wq callback is running, and doesn't lead to call_rcu_tasks_trace() repeatedly after failing cancel_work, if wq callback is not pending. ==================== Link: https://patch.msgid.link/20260205003853.527571-1-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf')
-rw-r--r--kernel/bpf/helpers.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 01052f8664eb..a4f039cee88b 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -1257,7 +1257,7 @@ static void bpf_async_cb_rcu_tasks_trace_free(struct rcu_head *rcu)
retry = true;
break;
case BPF_ASYNC_TYPE_WQ:
- if (!cancel_work(&w->work))
+ if (!cancel_work(&w->work) && work_busy(&w->work))
retry = true;
break;
}
@@ -1664,6 +1664,7 @@ static void bpf_async_cancel_and_free(struct bpf_async_kern *async)
if (!cb)
return;
+ bpf_async_update_prog_callback(cb, NULL, NULL);
/*
* No refcount_inc_not_zero(&cb->refcnt) here. Dropping the last
* refcnt. Either synchronously or asynchronously in irq_work.