diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-01-22 15:23:46 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-01-22 15:23:46 +0000 |
commit | 885020429082df1c7644eac72c438a1f14474010 (patch) | |
tree | 34979115f2cda4f2af7efc7b1e92c37bbad79628 | |
parent | da218fbabc4fd7c48b2115bef645a38d6c99e91b (diff) |
Ensure that boot storage area exists and is large enough, before
installing boot code.
ok marco@
-rw-r--r-- | sys/dev/softraid.c | 8 |
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; |