diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 0ba6c818e924..cb418fb09b85 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -349,8 +349,10 @@ filt_procattach(struct knote *kn) if (p == NULL) return (ESRCH); - if ((error = p_cansee(curthread, p))) + if ((error = p_cansee(curthread, p))) { + PROC_UNLOCK(p); return (error); + } kn->kn_ptr.p_proc = p; kn->kn_flags |= EV_CLEAR; /* automatically set */