Lock the process around manipulations with p_flag.

Reported and reviewed by:	jh
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2012-03-13 22:00:46 +00:00
parent b1866dfea3
commit 7335ed90a0

View File

@ -738,10 +738,12 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options,
LIST_REMOVE(p, p_list); /* off zombproc */
sx_xunlock(&allproc_lock);
LIST_REMOVE(p, p_sibling);
PROC_LOCK(p);
if (p->p_flag & P_ORPHAN) {
LIST_REMOVE(p, p_orphan);
p->p_flag &= ~P_ORPHAN;
}
PROC_UNLOCK(p);
leavepgrp(p);
#ifdef PROCDESC
if (p->p_procdesc != NULL)