diff options
author | jkim <jkim@FreeBSD.org> | 2007-03-30 17:16:51 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2007-03-30 17:16:51 +0000 |
commit | 370456872584249a3df3b61af9e8be11dd56137f (patch) | |
tree | 4e1a2b805af21d8e93d01985a66f22d86b213344 | |
parent | f68b9b4a34e09dff7e1ff98eee1c0cae321cb883 (diff) | |
download | FreeBSD-src-370456872584249a3df3b61af9e8be11dd56137f.zip FreeBSD-src-370456872584249a3df3b61af9e8be11dd56137f.tar.gz |
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
-rw-r--r-- | sys/amd64/linux32/linux32_machdep.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 888c4fc..4feab9d 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -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); |