]> err.no Git - linux-2.6/commitdiff
[PATCH] cpuset: unsafe mm reference fix
authorPaul Jackson <pj@sgi.com>
Fri, 31 Mar 2006 10:30:51 +0000 (02:30 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 31 Mar 2006 20:18:55 +0000 (12:18 -0800)
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>
kernel/cpuset.c

index 2523a4b6a8c646040804f89f319cb7d88186df50..bf42381a41953233e5415b29c0053e8959346516 100644 (file)
@@ -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))