MFP4: 114193, 114194

Dont "return" in linux_clone() after we forked the new process in a case
of problems.  Move the copyout of p2->p_pid outside the emul_lock coverage.

Submitted by:	Roman Divacky
This commit is contained in:
Jung-uk Kim 2007-03-30 17:16:51 +00:00
parent e77a8f9d7d
commit 5e397f16cd

View File

@ -593,6 +593,10 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if ((args->flags & 0xffffff00) == LINUX_THREADING_FLAGS)
ff |= RFTHREAD;
if (args->flags & LINUX_CLONE_PARENT_SETTID)
if (args->parent_tidptr == NULL)
return (EINVAL);
error = fork1(td, ff, 0, &p2);
if (error)
return (error);
@ -611,17 +615,6 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
em = em_find(p2, EMUL_DOLOCK);
KASSERT(em != NULL, ("clone: emuldata not found.\n"));
/* and adjust it */
if (args->flags & LINUX_CLONE_PARENT_SETTID) {
if (args->parent_tidptr == NULL) {
EMUL_UNLOCK(&emul_lock);
return (EINVAL);
}
error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid));
if (error) {
EMUL_UNLOCK(&emul_lock);
return (error);
}
}
if (args->flags & LINUX_CLONE_THREAD) {
/* XXX: linux mangles pgrp and pptr somehow
@ -647,6 +640,13 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
EMUL_UNLOCK(&emul_lock);
if (args->flags & LINUX_CLONE_PARENT_SETTID) {
error = copyout(&p2->p_pid, args->parent_tidptr,
sizeof(p2->p_pid));
if (error)
printf(LMSG("copyout failed!"));
}
PROC_LOCK(p2);
p2->p_sigparent = exit_signal;
PROC_UNLOCK(p2);