From cc4ac89c29b51f7360b2478274529cfbea6cadfd Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 16 Jul 2012 12:15:59 +0000 Subject: Make sure we have a swap partition before trying to read or write hibernate info. ok mlarkin@ stsp@ --- sys/kern/subr_hibernate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sys/kern') 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 @@ -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 */ -- cgit v1.2.3