summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2020-09-12 11:57:24 +0000
committerbeck <beck@openbsd.org>2020-09-12 11:57:24 +0000
commit1a5ca5bab76e9bd3994c5815f8058a8b51b4ff59 (patch)
tree286c590c8fb11b8d2cadb5bcea04e7158e66ee8f
parentremove unused include that breaks regress (diff)
downloadwireguard-openbsd-1a5ca5bab76e9bd3994c5815f8058a8b51b4ff59.tar.xz
wireguard-openbsd-1a5ca5bab76e9bd3994c5815f8058a8b51b4ff59.zip
Add a NULL check in bufbackoff so we don't die when passed a NULL pmem range.
Noticed by, and based on a diff from Mike Small <smallm@sdf.org>.
-rw-r--r--sys/kern/vfs_bio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 3d6d071994f..de41d11ec56 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.201 2020/07/14 06:02:50 beck Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.202 2020/09/12 11:57:24 beck Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
@@ -309,7 +309,7 @@ bufbackoff(struct uvm_constraint_range *range, long size)
* If we will accept high memory for this backoff
* try to steal it from the high memory buffer cache.
*/
- if (range->ucr_high > dma_constraint.ucr_high) {
+ if (range != NULL && range->ucr_high > dma_constraint.ucr_high) {
struct buf *bp;
int64_t start = bcstats.numbufpages, recovered = 0;
int s = splbio();