summaryrefslogtreecommitdiff
path: root/sys/kern/kern_event.c
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2021-06-11 04:29:55 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2021-06-11 04:29:55 +0000
commit954cf16e1b481062b9b3c243a6c3378b9d5476cc (patch)
treeaae9f9a813f43a52cccfa741473cd070b7f7570a /sys/kern/kern_event.c
parent9ae18a322e5469e92ba0569db7ff4668f83e4f0d (diff)
Remember to lock kqueue mutex in filt_timermodify().
Reported-by: syzbot+c2aba7645a218ce03027@syzkaller.appspotmail.com
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r--sys/kern/kern_event.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 27cf6eca9bd..48d3400613a 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.165 2021/06/10 15:10:56 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.166 2021/06/11 04:29:54 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -466,18 +466,18 @@ filt_timerdetach(struct knote *kn)
int
filt_timermodify(struct kevent *kev, struct knote *kn)
{
+ struct kqueue *kq = kn->kn_kq;
struct timeout *to = kn->kn_hook;
- int s;
/* Reset the timer. Any pending events are discarded. */
timeout_del_barrier(to);
- s = splhigh();
+ mtx_enter(&kq->kq_lock);
if (kn->kn_status & KN_QUEUED)
knote_dequeue(kn);
kn->kn_status &= ~KN_ACTIVE;
- splx(s);
+ mtx_leave(&kq->kq_lock);
kn->kn_data = 0;
knote_modify(kev, kn);