diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2014-02-15 22:02:28 +0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-02-18 16:35:20 -0500 |
commit | 5bdfff96c69a4d5ab9c49e60abf9e070ecd2acbb (patch) | |
tree | dab862c9f8694478b58adf92d3e1c87ba5a24a44 /drivers/firewire | |
parent | fada94ee64e6e18793b1db60fb8278d2eddbf922 (diff) | |
download | talos-obmc-linux-5bdfff96c69a4d5ab9c49e60abf9e070ecd2acbb.tar.gz talos-obmc-linux-5bdfff96c69a4d5ab9c49e60abf9e070ecd2acbb.zip |
workqueue: ensure @task is valid across kthread_stop()
When a kworker should die, the kworkre is notified through WORKER_DIE
flag instead of kthread_should_stop(). This, IIRC, is primarily to
keep the test synchronized inside worker_pool lock. WORKER_DIE is
first set while holding pool->lock, the lock is dropped and
kthread_stop() is called.
Unfortunately, this means that there's a slight chance that the target
kworker may see WORKER_DIE before kthread_stop() finishes and exits
and frees the target task before or during kthread_stop().
Fix it by pinning the target task before setting WORKER_DIE and
putting it after kthread_stop() is done.
tj: Improved patch description and comment. Moved pinning above
WORKER_DIE for better signify what it's protecting.
CC: stable@vger.kernel.org
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/firewire')
0 files changed, 0 insertions, 0 deletions