Guard against invalid metadata.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2006-10-10 15:01:47 +00:00
parent 360df38e5f
commit 11b2174f58
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163206

View File

@ -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.",