summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2018-04-08 16:45:12 +0000
committermikeb <mikeb@openbsd.org>2018-04-08 16:45:12 +0000
commitc5b204d22f76fab27a48ca903418be5fb5c00451 (patch)
treeb5d0534d76c97521efb31b6ccd68fba5dcd54a3f
parentThe assault on Dutschke happened in 1968. (diff)
downloadwireguard-openbsd-c5b204d22f76fab27a48ca903418be5fb5c00451.tar.xz
wireguard-openbsd-c5b204d22f76fab27a48ca903418be5fb5c00451.zip
Test for preexisting conditions when re-enabling events
When an event that was disabled by EV_DISABLE or EV_DISPATCH is registered again, an associated filter must be ran to mark it active if a preexisting condition is present. The issue was reported and fix tested by Lukas Larsson <lukas at erlang.org>, thanks! ok mpi
-rw-r--r--sys/kern/kern_event.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index b5d36212c22..b9ec18e07e8 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.85 2018/04/03 09:10:02 mpi Exp $ */
+/* $OpenBSD: kern_event.c,v 1.86 2018/04/08 16:45:12 mikeb Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -676,6 +676,8 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p)
if ((kev->flags & EV_ENABLE) && (kn->kn_status & KN_DISABLED)) {
s = splhigh();
kn->kn_status &= ~KN_DISABLED;
+ if (kn->kn_fop->f_event(kn, 0))
+ kn->kn_status |= KN_ACTIVE;
if ((kn->kn_status & KN_ACTIVE) &&
((kn->kn_status & KN_QUEUED) == 0))
knote_enqueue(kn);