This will be used in next patches. No functionality change.

Signed-off-by: Kirill Tkhai <[email protected]>
---
 kernel/exit.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index a1b2bf7..5e82787 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -322,16 +322,20 @@ void mm_update_next_owner(struct mm_struct *mm)
         * Search in the children
         */
        list_for_each_entry(c, &p->children, sibling) {
-               if (c->mm == mm)
+               if (c->mm == mm) {
+                       get_task_struct(c);
                        goto assign_new_owner;
+               }
        }
 
        /*
         * Search in the siblings
         */
        list_for_each_entry(c, &p->real_parent->children, sibling) {
-               if (c->mm == mm)
+               if (c->mm == mm) {
+                       get_task_struct(c);
                        goto assign_new_owner;
+               }
        }
 
        /*
@@ -341,8 +345,10 @@ void mm_update_next_owner(struct mm_struct *mm)
                if (g->flags & PF_KTHREAD)
                        continue;
                for_each_thread(g, c) {
-                       if (c->mm == mm)
+                       if (c->mm == mm) {
+                               get_task_struct(c);
                                goto assign_new_owner;
+                       }
                        if (c->mm)
                                break;
                }
@@ -358,7 +364,6 @@ void mm_update_next_owner(struct mm_struct *mm)
 
 assign_new_owner:
        BUG_ON(c == p);
-       get_task_struct(c);
        /*
         * The task_lock protects c->mm from changing.
         * We always want mm->owner->mm == mm



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to