mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
kthread_add(): do not allow to attach the thread to a dead or dying process
Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
ba675bb948
commit
9636299233
|
@ -281,6 +281,10 @@ kthread_add1(void (*func)(void *), void *arg, struct proc *p,
|
|||
return (ENOMEM);
|
||||
|
||||
PROC_LOCK(p);
|
||||
if (p->p_state == PRS_ZOMBIE || (p->p_flag2 & P2_WEXIT) != 0) {
|
||||
PROC_UNLOCK(p);
|
||||
return (ESRCH);
|
||||
}
|
||||
oldtd = FIRST_THREAD_IN_PROC(p);
|
||||
|
||||
bzero(&newtd->td_startzero,
|
||||
|
|
Loading…
Reference in a new issue