summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_pool.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2010-01-16 03:08:00 +0000
committertedu <tedu@openbsd.org>2010-01-16 03:08:00 +0000
commitdaed6925a98b016535d92a31aa466ece5475302f (patch)
tree5ce7a043279e3b3fb4cea52db5fbaf5356457d76 /sys/kern/subr_pool.c
parentsync (diff)
downloadwireguard-openbsd-daed6925a98b016535d92a31aa466ece5475302f.tar.xz
wireguard-openbsd-daed6925a98b016535d92a31aa466ece5475302f.zip
When allocating from the item header pool, we can't sleep, as we may be holding a mutex which won't be released. From Christian Ehrhardt.
While here, fix another buglet: no need to pass down PR_ZERO either, as noticed by blambert@.
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r--sys/kern/subr_pool.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index ddf9ddb3a9e..afaa783f16a 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.90 2009/09/05 16:06:57 thib Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.91 2010/01/16 03:08:00 tedu Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -434,9 +434,8 @@ pool_alloc_item_header(struct pool *pp, caddr_t storage, int flags)
if ((pp->pr_roflags & PR_PHINPAGE) != 0)
ph = (struct pool_item_header *)(storage + pp->pr_phoffset);
- else {
- ph = pool_get(&phpool, flags);
- }
+ else
+ ph = pool_get(&phpool, flags & ~(PR_WAITOK | PR_ZERO));
return (ph);
}