summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2009-05-11 14:17:56 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2009-05-11 14:17:56 +0000
commitc66d2d2807882881b556c00e3ac84d6ac24a0dcc (patch)
treeb4384a04a27de6c14fa73c39f5f384acbb0a6e80 /sys/dev
parent0db0de08581cd0034c8ad5abaa5d8db6154ff832 (diff)
When probing for softraid chunks, ensure that a chunk has a valid metadata
signature, rather than just assuming that a partition of type RAID always has metadata. Add a similar test when validating native metadata. Whilst here, make sure that the metadata version is printed correctly. ok marco@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/softraid.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index f5a5dbc8339..b7e93a93b0f 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.132 2009/05/11 14:06:21 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.133 2009/05/11 14:17:55 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -752,8 +752,13 @@ sr_meta_validate(struct sr_discipline *sd, dev_t dev, struct sr_metadata *sm,
* format and will be treated just like the native format
*/
+ if (sm->ssdi.ssd_magic != SR_MAGIC) {
+ printf("%s: not valid softraid metadata\n", DEVNAME(sc));
+ goto done;
+ }
+
if (sm->ssdi.ssd_version != SR_META_VERSION) {
- printf("%s: %s can not read metadata version %d, expected %d\n",
+ printf("%s: %s can not read metadata version %u, expected %u\n",
DEVNAME(sc), devname, sm->ssdi.ssd_version,
SR_META_VERSION);
goto done;
@@ -876,6 +881,8 @@ sr_meta_native_bootprobe(struct sr_softc *sc, struct device *dv,
}
/* are we a softraid partition? */
+ if (md->ssdi.ssd_magic != SR_MAGIC)
+ continue;
sr_meta_getdevname(sc, devr, devname, sizeof(devname));
if (sr_meta_validate(fake_sd, devr, md, NULL) == 0) {
if (md->ssdi.ssd_flags & BIOC_SCNOAUTOASSEMBLE) {