Skip to content
Commit 4ae558c5 authored by Junfan Song's avatar Junfan Song Committed by Carles Cufí
Browse files

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: default avatarJunfan Song <sjf221100@gmail.com>
parent b8184ca3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment