summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2011-01-22 15:23:45 +0000
committerjsing <jsing@openbsd.org>2011-01-22 15:23:45 +0000
commitfdb7fdcf99a695488b13b71b8f64488d4f5101ef (patch)
tree5a70c847d1cf97cd3164777e8c80b71e9b0c7aff
parentLots of in-line macros require arguments but were not marked as such. (diff)
downloadwireguard-openbsd-fdb7fdcf99a695488b13b71b8f64488d4f5101ef.tar.xz
wireguard-openbsd-fdb7fdcf99a695488b13b71b8f64488d4f5101ef.zip
Ensure that boot storage area exists and is large enough, before
installing boot code. ok marco@
-rw-r--r--sys/dev/softraid.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index dc1bdae598d..089e6bf82c3 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.218 2011/01/12 20:38:33 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.219 2011/01/22 15:23:45 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -3188,6 +3188,12 @@ sr_ioctl_installboot(struct sr_softc *sc, struct bioc_installboot *bb)
if (sd == NULL)
goto done;
+ /* Ensure that boot storage area is large enough. */
+ if (sd->sd_meta->ssd_data_offset < (SR_BOOT_OFFSET + SR_BOOT_SIZE)) {
+ printf("%s: insufficient boot storage!\n", DEVNAME(sd->sd_sc));
+ goto done;
+ }
+
if (bb->bb_bootblk_size > SR_BOOT_BLOCKS_SIZE * 512)
goto done;