summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2012-07-11 12:31:29 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2012-07-11 12:31:29 +0000
commitdcd93e0f82fbc4edfb9f7d89873dc721922d4735 (patch)
treed1cddd8c1585550e1fdca8754c99ed07c4659d81 /sys
parentc1accf2c422a1252f665135ccd0ac4f2ad10a4a5 (diff)
add a check for the total size of swap, abort if too small.
used by the hibernate code. ok deraadt@
Diffstat (limited to 'sys')
-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)