summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorups <ups@FreeBSD.org>2005-09-15 21:10:12 +0000
committerups <ups@FreeBSD.org>2005-09-15 21:10:12 +0000
commit6e520a23cd8143a93f5f424daf9620b3d54d1de2 (patch)
tree774450f4cf1544a2a2b520cf54e002e82424da65 /sys
parentb16fb05c6cf67023248375401d4f960252618aa5 (diff)
downloadFreeBSD-src-6e520a23cd8143a93f5f424daf9620b3d54d1de2.zip
FreeBSD-src-6e520a23cd8143a93f5f424daf9620b3d54d1de2.tar.gz
Fix race condition that caused activation of an event to
be ignored immediately after it was deactivated. Found by: Yahoo! MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_event.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 2e71f23..3aa4550 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1242,11 +1242,11 @@ start:
KQ_GLOBAL_LOCK(&kq_global, haskqglobal);
KN_LIST_LOCK(kn);
if (kn->kn_fop->f_event(kn, 0) == 0) {
- KN_LIST_UNLOCK(kn);
KQ_LOCK(kq);
kn->kn_status &=
~(KN_QUEUED | KN_ACTIVE | KN_INFLUX);
kq->kq_count--;
+ KN_LIST_UNLOCK(kn);
continue;
}
*kevp = kn->kn_kevent;
@@ -1258,8 +1258,10 @@ start:
kq->kq_count--;
} else
TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe);
- KN_LIST_UNLOCK(kn);
+
kn->kn_status &= ~(KN_INFLUX);
+ KN_LIST_UNLOCK(kn);
+
}
/* we are returning a copy to the user */
OpenPOWER on IntegriCloud