summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2013-10-19 09:24:58 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2013-10-19 09:24:58 +0000
commitdc05eaace09fc998d4d12fd34621f2a18b1e139d (patch)
tree83aad56c4cfc4055c3adaba9a65ce304ff4df719
parent92cfd7e86dba55a3f569deca81f47bd405ccc228 (diff)
When hooks are called, allow them to disestablish themselves by using
the safe version to traverse the TAILQ list. ok deraadt@
-rw-r--r--sys/kern/kern_subr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 16310190e47..2e3bacb3100 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.36 2013/09/14 02:28:01 guenther Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.37 2013/10/19 09:24:57 reyk Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -233,10 +233,10 @@ hook_disestablish(struct hook_desc_head *head, void *vhook)
void
dohooks(struct hook_desc_head *head, int flags)
{
- struct hook_desc *hdp;
+ struct hook_desc *hdp, *hdp_temp;
if ((flags & HOOK_REMOVE) == 0) {
- TAILQ_FOREACH(hdp, head, hd_list) {
+ TAILQ_FOREACH_SAFE(hdp, head, hd_list, hdp_temp) {
(*hdp->hd_fn)(hdp->hd_arg);
}
} else {