summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index c2e47d4e9bc3..90a4f4c98910 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -98,6 +98,8 @@ struct execve_args {
/*
* execve() system call.
+ *
+ * MPSAFE
*/
int
execve(p, uap)
@@ -133,6 +135,8 @@ execve(p, uap)
imgp->ps_strings = 0;
imgp->auxarg_size = 0;
+ mtx_lock(&Giant);
+
/*
* Allocate temporary demand zeroed space for argument and
* environment strings
@@ -445,17 +449,18 @@ exec_fail_dealloc:
}
if (error == 0)
- return (0);
+ goto done2;
exec_fail:
if (imgp->vmspace_destroyed) {
/* sorry, no more process anymore. exit gracefully */
exit1(p, W_EXITCODE(0, SIGABRT));
/* NOT REACHED */
- return(0);
- } else {
- return(error);
- }
+ error = 0;
+ }
+done2:
+ mtx_unlock(&Giant);
+ return(error);
}
int