return nr;
}
-static int coredump_wait(int exit_code)
+static int coredump_wait(int exit_code, struct core_state *core_state)
{
struct task_struct *tsk = current;
struct mm_struct *mm = tsk->mm;
- struct core_state core_state;
struct completion *vfork_done;
int core_waiters;
init_completion(&mm->core_done);
- init_completion(&core_state.startup);
- core_waiters = zap_threads(tsk, mm, &core_state, exit_code);
+ init_completion(&core_state->startup);
+ core_waiters = zap_threads(tsk, mm, core_state, exit_code);
up_write(&mm->mmap_sem);
if (unlikely(core_waiters < 0))
}
if (core_waiters)
- wait_for_completion(&core_state.startup);
- mm->core_state = NULL;
+ wait_for_completion(&core_state->startup);
fail:
return core_waiters;
}
int do_coredump(long signr, int exit_code, struct pt_regs * regs)
{
+ struct core_state core_state;
char corename[CORENAME_MAX_SIZE + 1];
struct mm_struct *mm = current->mm;
struct linux_binfmt * binfmt;
current->fsuid = 0; /* Dump root private */
}
- retval = coredump_wait(exit_code);
+ retval = coredump_wait(exit_code, &core_state);
if (retval < 0)
goto fail;
current->fsuid = fsuid;
complete_all(&mm->core_done);
+ mm->core_state = NULL;
fail:
return retval;
}