summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2012-07-16 12:15:59 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2012-07-16 12:15:59 +0000
commitcc4ac89c29b51f7360b2478274529cfbea6cadfd (patch)
tree6b4e19d28c3b4ac834325e1d89dcf368a42fe375 /sys
parent24ac06967282351a85e9eb2c35aec61373875395 (diff)
Make sure we have a swap partition before trying to read or write
hibernate info. ok mlarkin@ stsp@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_hibernate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index 8615214d58f..abd50deeb5a 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.43 2012/07/15 16:09:14 stsp Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.44 2012/07/16 12:15:58 jsing Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -622,6 +622,11 @@ get_hibernate_info(union hibernate_info *hiber_info, int suspend)
return (1);
}
+ /* Make sure we have a swap partition. */
+ if (dl.d_partitions[1].p_fstype != FS_SWAP ||
+ dl.d_partitions[1].p_size == 0)
+ return (1);
+
hiber_info->secsize = dl.d_secsize;
/* Make sure the signature can fit in one block */