RE: [PATCH] mm : Avoid candidate task is equal to current task

From: Peter Chiang
Date: Wed Apr 16 2014 - 08:31:44 EST


mm_update_next_owner() call from exit_mm() , and exit_mm() change tsk->mm to NULL
If p==c , It seems to be impossible that mm == c->mm (tsk->mm) . Because mm is non-NULL and c->mm is NULL .


-----Original Message-----
From: Peter Chiang [mailto:pchiang@xxxxxxxxxx]
Sent: Wednesday, April 16, 2014 11:03 AM
To: ccross@xxxxxxxxxxx; Peter Chiang; lizefan@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; oleg@xxxxxxxxxx; tj@xxxxxxxxxx; pavel@xxxxxx; ebiederm@xxxxxxxxxxxx; guillaume@xxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] mm : Avoid candidate task is equal to current task

From: pchiang <pchiang@xxxxxxxxxx>

Fix kernel panic when finding a new owner for the mm and the new owner is equal to current onwer

Signed-off-by: pchiang <pchiang@xxxxxxxxxx>
---
kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/exit.c b/kernel/exit.c index 6ed6a1d..aa98422 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -399,7 +399,7 @@ retry:
* here often
*/
do_each_thread(g, c) {
- if (c->mm == mm)
+ if ((c != p) && (c->mm == mm))
goto assign_new_owner;
} while_each_thread(g, c);

--
1.8.1.5

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