summaryrefslogtreecommitdiff
path: root/sys/compat/linux32/common/linux32_exec.c
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2008-04-23 13:30:41 +0000
committerad <ad@NetBSD.org>2008-04-23 13:30:41 +0000
commit6bf00a454ded679cb2440b93c7387d08a8c343a6 (patch)
tree3546ec909d4b654a415de661ea5f5b8d461a30a8 /sys/compat/linux32/common/linux32_exec.c
parent3b31064c9a55507e18785706944dec7b33c35b0b (diff)
Catch up with linux.
Diffstat (limited to 'sys/compat/linux32/common/linux32_exec.c')
-rw-r--r--sys/compat/linux32/common/linux32_exec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/compat/linux32/common/linux32_exec.c b/sys/compat/linux32/common/linux32_exec.c
index 3e7906d7f8d..200155237d7 100644
--- a/sys/compat/linux32/common/linux32_exec.c
+++ b/sys/compat/linux32/common/linux32_exec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_exec.c,v 1.9 2007/12/08 18:36:11 dsl Exp $ */
+/* $NetBSD: linux32_exec.c,v 1.10 2008/04/23 13:30:41 ad Exp $ */
/*-
* Copyright (c) 1994-2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.9 2007/12/08 18:36:11 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.10 2008/04/23 13:30:41 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -139,9 +139,11 @@ linux32_e_proc_init(p, parent, forkflags)
MALLOC(e, void *, sizeof(struct linux_emuldata),
M_EMULDATA, M_WAITOK);
} else {
+ mutex_enter(&proclist_lock);
e->s->refs--;
if (e->s->refs == 0)
FREE(e->s, M_EMULDATA);
+ mutex_exit(&proclist_lock);
}
memset(e, '\0', sizeof(struct linux_emuldata));
@@ -158,6 +160,7 @@ linux32_e_proc_init(p, parent, forkflags)
return;
}
#endif
+ mutex_enter(&proclist_lock);
s = ep->s;
s->refs++;
} else {
@@ -192,6 +195,7 @@ linux32_e_proc_init(p, parent, forkflags)
s->xstat = 0;
s->flags = 0;
+ mutex_enter(&proclist_lock);
}
e->s = s;
@@ -200,6 +204,7 @@ linux32_e_proc_init(p, parent, forkflags)
* Add this thread in the group thread list
*/
LIST_INSERT_HEAD(&s->threads, e, threads);
+ mutex_exit(&proclist_lock);
#ifdef LINUX32_NPTL
linux_nptl_proc_init(p, parent);
@@ -233,14 +238,16 @@ linux32_e_proc_exit(struct proc *p)
#endif /* LINUX32_NPTL */
/* Remove the thread for the group thread list */
+ mutex_enter(&proclist_lock);
LIST_REMOVE(e, threads);
/* free Linux emuldata and set the pointer to null */
e->s->refs--;
if (e->s->refs == 0)
FREE(e->s, M_EMULDATA);
- FREE(e, M_EMULDATA);
p->p_emuldata = NULL;
+ mutex_exit(&proclist_lock);
+ FREE(e, M_EMULDATA);
}
/*