Commit 2741a559 authored by Paul Jackson's avatar Paul Jackson Committed by Linus Torvalds

[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: default avatarPaul Jackson <pj@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4a01c8d5
...@@ -1183,11 +1183,11 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf) ...@@ -1183,11 +1183,11 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)
mm = get_task_mm(tsk); mm = get_task_mm(tsk);
if (mm) { if (mm) {
mpol_rebind_mm(mm, &to); mpol_rebind_mm(mm, &to);
if (is_memory_migrate(cs))
do_migrate_pages(mm, &from, &to, MPOL_MF_MOVE_ALL);
mmput(mm); mmput(mm);
} }
if (is_memory_migrate(cs))
do_migrate_pages(tsk->mm, &from, &to, MPOL_MF_MOVE_ALL);
put_task_struct(tsk); put_task_struct(tsk);
synchronize_rcu(); synchronize_rcu();
if (atomic_dec_and_test(&oldcs->count)) if (atomic_dec_and_test(&oldcs->count))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment