Skip to content

Commit ebebda9

Browse files
author
cludwig
committed
pool: Check early that we can sleep
Check early that we actuallly are in a sleepable context in pool_get(). There is an equivalent check in malloc(). from jsg@, ok jca@
1 parent 9b7e9ac commit ebebda9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sys/kern/subr_pool.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: subr_pool.c,v 1.241 2025/07/21 20:36:41 bluhm Exp $ */
1+
/* $OpenBSD: subr_pool.c,v 1.242 2025/08/01 19:00:38 cludwig Exp $ */
22
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
33

44
/*-
@@ -562,6 +562,9 @@ pool_get(struct pool *pp, int flags)
562562
void *v = NULL;
563563
int slowdown = 0;
564564

565+
if (flags & PR_WAITOK)
566+
assertwaitok();
567+
565568
KASSERT(flags & (PR_WAITOK | PR_NOWAIT));
566569
if (pp->pr_flags & PR_RWLOCK)
567570
KASSERT(flags & PR_WAITOK);

0 commit comments

Comments
 (0)