diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2021-01-08 12:29:17 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2021-01-08 12:29:17 +0000 |
commit | f01a7728846027018ffef8de4f0dff512c7cd033 (patch) | |
tree | c9d624a7284565dd780534fb48c6ac2f227852e7 /sys/kern | |
parent | 4d8d769fb52fde612ac92065ae5a61184cbe661c (diff) |
Lock kernel before raising SPL in klist_lock()
This prevents unwanted spinning with interrupts disabled.
At the moment, this code is only invoked through klist_invalidate()
and the callers should already hold the kernel lock. Also, one could
argue that in MP-unsafe contexts klist_lock() should only assert for
the kernel lock.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_event.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index d900899dfb5..deb3aadddc6 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.157 2021/01/07 11:08:59 visa Exp $ */ +/* $OpenBSD: kern_event.c,v 1.158 2021/01/08 12:29:16 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -1665,8 +1665,8 @@ klist_lock(struct klist *list) if (list->kl_ops != NULL) { ls = list->kl_ops->klo_lock(list->kl_arg); } else { - ls = splhigh(); KERNEL_LOCK(); + ls = splhigh(); } return ls; } @@ -1677,8 +1677,8 @@ klist_unlock(struct klist *list, int ls) if (list->kl_ops != NULL) { list->kl_ops->klo_unlock(list->kl_arg, ls); } else { - KERNEL_UNLOCK(); splx(ls); + KERNEL_UNLOCK(); } } |