Commit 902a0b68 authored by Colin Gibbs's avatar Colin Gibbs Committed by David S. Miller

copy_mm fix:

- If dup_mmap fails we will try to destroy_context before
init_new_context occurs.  Platforms with non-trivial
init_new_context can explode because of this.  The fix
is to invoke init_new_context before dup_mmap.
parent 702d27c7
...@@ -387,6 +387,9 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) ...@@ -387,6 +387,9 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
if (!mm_init(mm)) if (!mm_init(mm))
goto fail_nomem; goto fail_nomem;
if (init_new_context(tsk,mm))
goto free_pt;
down_write(&oldmm->mmap_sem); down_write(&oldmm->mmap_sem);
retval = dup_mmap(mm); retval = dup_mmap(mm);
up_write(&oldmm->mmap_sem); up_write(&oldmm->mmap_sem);
...@@ -394,9 +397,6 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) ...@@ -394,9 +397,6 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
if (retval) if (retval)
goto free_pt; goto free_pt;
if (init_new_context(tsk,mm))
goto free_pt;
good_mm: good_mm:
tsk->mm = mm; tsk->mm = mm;
tsk->active_mm = mm; tsk->active_mm = mm;
......
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