瀏覽代碼

cpuset: fix a race condition in __cpuset_node_allowed_softwall()

It's not safe to access task's cpuset after releasing task_lock().
Holding callback_mutex won't help.

Cc: <stable@vger.kernel.org>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Li Zefan 11 年之前
父節點
當前提交
99afb0fd5f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      kernel/cpuset.c

+ 1 - 1
kernel/cpuset.c

@@ -2482,9 +2482,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
 
 
 	task_lock(current);
 	task_lock(current);
 	cs = nearest_hardwall_ancestor(task_cs(current));
 	cs = nearest_hardwall_ancestor(task_cs(current));
+	allowed = node_isset(node, cs->mems_allowed);
 	task_unlock(current);
 	task_unlock(current);
 
 
-	allowed = node_isset(node, cs->mems_allowed);
 	mutex_unlock(&callback_mutex);
 	mutex_unlock(&callback_mutex);
 	return allowed;
 	return allowed;
 }
 }