summaryrefslogtreecommitdiffstats
path: root/sys/geom/raid3
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-10-10 15:01:47 +0000
committerpjd <pjd@FreeBSD.org>2006-10-10 15:01:47 +0000
commite4e060fa9e549de7822c3931c1919f5b2ac44b6e (patch)
treedeb3777e08d43029a288ac11a5c8d20668e6ee65 /sys/geom/raid3
parent0c8c135ad5c67d351ddd0d30f8c03255cade078f (diff)
downloadFreeBSD-src-e4e060fa9e549de7822c3931c1919f5b2ac44b6e.zip
FreeBSD-src-e4e060fa9e549de7822c3931c1919f5b2ac44b6e.tar.gz
Guard against invalid metadata.
MFC after: 1 week
Diffstat (limited to 'sys/geom/raid3')
-rw-r--r--sys/geom/raid3/g_raid3.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index ba8b886..66383bc 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -2859,6 +2859,12 @@ g_raid3_check_metadata(struct g_raid3_softc *sc, struct g_provider *pp,
"md_all", pp->name, sc->sc_name);
return (EINVAL);
}
+ if ((md->md_mediasize % md->md_sectorsize) != 0) {
+ G_RAID3_DEBUG(1, "Invalid metadata (mediasize %% sectorsize != "
+ "0) on disk %s (device %s), skipping.", pp->name,
+ sc->sc_name);
+ return (EINVAL);
+ }
if (md->md_mediasize != sc->sc_mediasize) {
G_RAID3_DEBUG(1,
"Invalid '%s' field on disk %s (device %s), skipping.",
OpenPOWER on IntegriCloud