summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/os/fork.c')
-rw-r--r--usr/src/uts/common/os/fork.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/src/uts/common/os/fork.c b/usr/src/uts/common/os/fork.c
index aae3f69a59..77c22aa7bb 100644
--- a/usr/src/uts/common/os/fork.c
+++ b/usr/src/uts/common/os/fork.c
@@ -272,6 +272,8 @@ cfork(int isvfork, int isfork1, int flags)
error = as_dup(p->p_as, &cp->p_as);
if (error != 0) {
+ mutex_enter(&p->p_lock);
+ sprunlock(p);
fork_fail(cp);
mutex_enter(&pidlock);
orphpp = &p->p_orphan;
@@ -298,7 +300,7 @@ cfork(int isvfork, int isfork1, int flags)
p->p_flag &= ~SFORKING;
pool_barrier_exit();
continuelwps(p);
- sprunlock(p);
+ mutex_exit(&p->p_lock);
/*
* Preserve ENOMEM error condition but
* map all others to EAGAIN.