summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul Jackson <pj@sgi.com>2006-03-31 12:30:51 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 22:18:55 +0200
commit2741a559a01e1ba9bf87285569dc1a104d134ecf (patch)
tree8c61321d5fa1a0c3517219eaa3089e223d5cd943 /kernel
parent[PATCH] cpuset: task_lock comment fix (diff)
downloadlinux-2741a559a01e1ba9bf87285569dc1a104d134ecf.tar.xz
linux-2741a559a01e1ba9bf87285569dc1a104d134ecf.zip
[PATCH] cpuset: unsafe mm reference fix
Fix unsafe reference to a tasks mm struct, by moving the reference inside of a convenient nearby properly guarded code block. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 2523a4b6a8c6..bf42381a4195 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1183,11 +1183,11 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)
mm = get_task_mm(tsk);
if (mm) {
mpol_rebind_mm(mm, &to);
+ if (is_memory_migrate(cs))
+ do_migrate_pages(mm, &from, &to, MPOL_MF_MOVE_ALL);
mmput(mm);
}
- if (is_memory_migrate(cs))
- do_migrate_pages(tsk->mm, &from, &to, MPOL_MF_MOVE_ALL);
put_task_struct(tsk);
synchronize_rcu();
if (atomic_dec_and_test(&oldcs->count))