zephyr/kernel
Junfan Song 4ae558c505 kernel: work: Fix race in workqueue thread
After a call to k_work_flush returns the sync variable
may still be modified by the workq.  This is because
the work queue thread continues to modify the flag in
sync even after k_work_flush returns.  This commit adds
K_WORK_FLUSHING_BIT, and with this bit, we moved the
logic of waking up the caller from handle_flush to the
finalize_flush_locked in workq, so that after waking up
the caller, the workqueue will no longer operate on sync.

Fixes: #64530

Signed-off-by: Junfan Song <sjf221100@gmail.com>
2024-01-03 10:20:19 +01:00
..
include
paging
CMakeLists.txt
Kconfig
Kconfig.vm
atomic_c.c
banner.c
busy_wait.c
compiler_stack_protect.c
condvar.c
device.c
dynamic.c
dynamic_disabled.c
errno.c
events.c
fatal.c
futex.c
idle.c
init.c
kheap.c
mailbox.c
main_weak.c
mem_domain.c
mem_slab.c
mempool.c
mmu.c
msg_q.c
mutex.c
obj_core.c
pipes.c
poll.c
queue.c
sched.c
sem.c
smp.c
stack.c
system_work_q.c
thread.c
timeout.c
timer.c
usage.c
userspace.c
userspace_handler.c
version.c
work.c
xip.c