diff options
author | ups <ups@FreeBSD.org> | 2005-09-15 21:10:12 +0000 |
---|---|---|
committer | ups <ups@FreeBSD.org> | 2005-09-15 21:10:12 +0000 |
commit | 6e520a23cd8143a93f5f424daf9620b3d54d1de2 (patch) | |
tree | 774450f4cf1544a2a2b520cf54e002e82424da65 | |
parent | b16fb05c6cf67023248375401d4f960252618aa5 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/kern/kern_event.c | 6 |
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 */ |