summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2012-07-11 12:31:28 +0000
committermlarkin <mlarkin@openbsd.org>2012-07-11 12:31:28 +0000
commitbbba7c70b38d4ceba74b2046cfe221e9847926a4 (patch)
tree9f9ecdd5827b2be13976a64eff0c500a60a70f3a
parentfirst go at a manpage (diff)
downloadwireguard-openbsd-bbba7c70b38d4ceba74b2046cfe221e9847926a4.tar.xz
wireguard-openbsd-bbba7c70b38d4ceba74b2046cfe221e9847926a4.zip
add a check for the total size of swap, abort if too small.
used by the hibernate code. ok deraadt@
-rw-r--r--sys/uvm/uvm_swap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index 6b7568b0a65..2c117da8805 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.106 2012/07/11 10:07:40 mlarkin Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.107 2012/07/11 12:31:28 mlarkin Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -2116,6 +2116,9 @@ uvm_swap_check_range(dev_t swdev, size_t size)
ex = swd->swd_ex;
start = swd->swd_drumsize-npages;
+ if (npages > swd->swd_drumsize)
+ return (1);
+
LIST_FOREACH(exr, &ex->ex_regions, er_link)
{
if (exr->er_end >= start)