From: Li Zefan Date: Thu, 27 Feb 2014 10:19:36 +0000 (+0800) Subject: cpuset: fix a race condition in __cpuset_node_allowed_softwall() X-Git-Tag: v3.13.7~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a59929c894645615835deb478f99de178530b22;p=thirdparty%2Fkernel%2Fstable.git cpuset: fix a race condition in __cpuset_node_allowed_softwall() commit 99afb0fd5f05aac467ffa85c36778fec4396209b 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 Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/cpuset.c b/kernel/cpuset.c index bd1dfa2c7d890..5ae9f950e024a 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -2507,9 +2507,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) task_lock(current); cs = nearest_hardwall_ancestor(task_cs(current)); + allowed = node_isset(node, cs->mems_allowed); task_unlock(current); - allowed = node_isset(node, cs->mems_allowed); mutex_unlock(&callback_mutex); return allowed; }