diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2008-05-12 17:02:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:25 -0400 |
commit | 4cd1a8fc3d3cd740416b14ece2693dbb5d065eaf (patch) | |
tree | 2acebe40e15b91a3df78ea5b677a84c509a30ae0 /fs | |
parent | c9bfcb3151040cff6714542d1da04ccd7e2d3efc (diff) |
memcg: fix possible panic when CONFIG_MM_OWNER=y
When mm destruction happens, we should pass mm_update_next_owner() the old mm.
But unfortunately new mm is passed in exec_mmap().
Thus, kernel panic is possible when a multi-threaded process uses exec().
Also, the owner member comment description is wrong. mm->owner does not
necessarily point to the thread group leader.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: "Paul Menage" <menage@google.com>
Cc: "KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -736,7 +736,7 @@ static int exec_mmap(struct mm_struct *mm) | |||
736 | tsk->active_mm = mm; | 736 | tsk->active_mm = mm; |
737 | activate_mm(active_mm, mm); | 737 | activate_mm(active_mm, mm); |
738 | task_unlock(tsk); | 738 | task_unlock(tsk); |
739 | mm_update_next_owner(mm); | 739 | mm_update_next_owner(old_mm); |
740 | arch_pick_mmap_layout(mm); | 740 | arch_pick_mmap_layout(mm); |
741 | if (old_mm) { | 741 | if (old_mm) { |
742 | up_read(&old_mm->mmap_sem); | 742 | up_read(&old_mm->mmap_sem); |