summaryrefslogtreecommitdiffstats
path: root/sys/kern/p1003_1b.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-04-24 00:51:53 +0000
committerjhb <jhb@FreeBSD.org>2001-04-24 00:51:53 +0000
commit9c03a8ae91e06e47f0c59996ef0e2300e231e101 (patch)
treeec00c764b1eb58ed4297070edb5806ffd7ca4765 /sys/kern/p1003_1b.c
parent383dd0a2656889604bb7eb71b993875024ddd832 (diff)
downloadFreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.zip
FreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.tar.gz
Change the pfind() and zpfind() functions to lock the process that they
find before releasing the allproc lock and returning. Reviewed by: -smp, dfr, jake
Diffstat (limited to 'sys/kern/p1003_1b.c')
-rw-r--r--sys/kern/p1003_1b.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/p1003_1b.c b/sys/kern/p1003_1b.c
index 860176a..0d1fd0e 100644
--- a/sys/kern/p1003_1b.c
+++ b/sys/kern/p1003_1b.c
@@ -87,9 +87,10 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp)
int ret = 0;
struct proc *other_proc = 0;
- if (pid == 0)
+ if (pid == 0) {
other_proc = p;
- else
+ PROC_LOCK(p);
+ } else
other_proc = pfind(pid);
if (other_proc)
@@ -100,6 +101,7 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp)
*pp = other_proc;
else
ret = EPERM;
+ PROC_UNLOCK(other_proc);
}
else
ret = ESRCH;
OpenPOWER on IntegriCloud