diff options
-rw-r--r-- | kernel/cpuset.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index cc0395d7eba1..8c3c400cce91 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1225,7 +1225,12 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf) | |||
1225 | 1225 | ||
1226 | task_lock(tsk); | 1226 | task_lock(tsk); |
1227 | oldcs = tsk->cpuset; | 1227 | oldcs = tsk->cpuset; |
1228 | if (!oldcs) { | 1228 | /* |
1229 | * After getting 'oldcs' cpuset ptr, be sure still not exiting. | ||
1230 | * If 'oldcs' might be the top_cpuset due to the_top_cpuset_hack | ||
1231 | * then fail this attach_task(), to avoid breaking top_cpuset.count. | ||
1232 | */ | ||
1233 | if (tsk->flags & PF_EXITING) { | ||
1229 | task_unlock(tsk); | 1234 | task_unlock(tsk); |
1230 | mutex_unlock(&callback_mutex); | 1235 | mutex_unlock(&callback_mutex); |
1231 | put_task_struct(tsk); | 1236 | put_task_struct(tsk); |