diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2023-07-06 10:16:59 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2023-07-06 10:16:59 +0000 |
commit | 5768a263116aac1447c32fa399d3a2aff92c21c2 (patch) | |
tree | e30350b739f16a405d106b434cd28debeaffa3da /sys/dev | |
parent | f135aca3b671e4e654082f394fddce9b22bfc85a (diff) |
Clear knotes when finishing wseventvar
When finishing a wseventvar in wsevent_fini(), clear the klist.
Otherwise knotes can be left dangling, which can crash the kernel.
In general, klist_invalidate() should happen after vdevgone() in order
to avoid a race with kevent registration. However, the current wscons
drivers clear the wsevent pointer (sc->sc_base.me_evp) before calling
wsevent_fini(). This prevents the drivers from registering new kevents.
Prompted by a report by Peter J. Philipp on bugs@
OK mvs@ miod@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/wscons/wsevent.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index 89ff7840601..37dc66bc72d 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsevent.c,v 1.26 2022/07/02 08:50:42 visa Exp $ */ +/* $OpenBSD: wsevent.c,v 1.27 2023/07/06 10:16:58 visa Exp $ */ /* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */ /* @@ -134,6 +134,8 @@ wsevent_fini(struct wseventvar *ev) free(ev->q, M_DEVBUF, WSEVENT_QSIZE * sizeof(struct wscons_event)); ev->q = NULL; + klist_invalidate(&ev->sel.si_note); + sigio_free(&ev->sigio); } |