Skip to content

Commit 4bdd401

Browse files
lizf-osgregkh
authored andcommitted
cpuset: fix a race condition in __cpuset_node_allowed_softwall()
commit 99afb0f upstream. It's not safe to access task's cpuset after releasing task_lock(). Holding callback_mutex won't help. Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 56f1c41 commit 4bdd401

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/cpuset.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,9 +2422,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
24222422

24232423
task_lock(current);
24242424
cs = nearest_hardwall_ancestor(task_cs(current));
2425+
allowed = node_isset(node, cs->mems_allowed);
24252426
task_unlock(current);
24262427

2427-
allowed = node_isset(node, cs->mems_allowed);
24282428
mutex_unlock(&callback_mutex);
24292429
return allowed;
24302430
}

0 commit comments

Comments
 (0)