summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-09 13:08:36 +0000
committerphk <phk@FreeBSD.org>2003-04-09 13:08:36 +0000
commitb62dc48437d2a819c6cdb2e2b2e66215e94fd438 (patch)
treeb63368cb79982adc0cab227a8daff2bb166f7b87
parente66eeacdc825e000d353f98b7156681a060f70ff (diff)
downloadFreeBSD-src-b62dc48437d2a819c6cdb2e2b2e66215e94fd438.zip
FreeBSD-src-b62dc48437d2a819c6cdb2e2b2e66215e94fd438.tar.gz
With the magic sequence checks removed this class is downright dangerous
to have in your kernel since it indiscriminately attaches to anything it is offered with a range of bogus partitions. Stop this from happening by rejecting any label with negative numbers in it.
-rw-r--r--sys/geom/geom_pc98.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c
index d9ed6da..8c5775c 100644
--- a/sys/geom/geom_pc98.c
+++ b/sys/geom/geom_pc98.c
@@ -114,7 +114,7 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec)
#if 0
/*
* XXX: Some sources indicate this is a magic sequence, but appearantly
- * XXX: it is not universal. Documentation would be wonderfule to have.
+ * XXX: it is not universal. Documentation would be wonderful to have.
*/
if (sec[4] != 'I' || sec[5] != 'P' || sec[6] != 'L' || sec[7] != '1')
return (EBUSY);
@@ -142,7 +142,10 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec)
printf("PC98 Slice %d on %s:\n", i + 1, gp->name);
g_pc98_print(i, dp + i);
}
- error = g_slice_config(gp, i, G_SLICE_CONFIG_CHECK,
+ if (s[i] < 0 || l[i] < 0)
+ error = EBUSY;
+ else
+ error = g_slice_config(gp, i, G_SLICE_CONFIG_CHECK,
s[i], l[i], ms->sectorsize,
"%ss%d", gp->name, i + 1);
if (error)
@@ -311,14 +314,16 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
error = g_getattr("GEOM::fwsectors", cp, &fwsectors);
if (error || fwsectors == 0) {
fwsectors = 17;
- printf("g_pc98_taste: error %d guessing %d sectors\n",
- error, fwsectors);
+ if (bootverbose)
+ printf("g_pc98_taste: guessing %d sectors\n",
+ fwsectors);
}
error = g_getattr("GEOM::fwheads", cp, &fwheads);
if (error || fwheads == 0) {
fwheads = 8;
- printf("g_pc98_taste: error %d guessing %d heads\n",
- error, fwheads);
+ if (bootverbose)
+ printf("g_pc98_taste: guessing %d heads\n",
+ fwheads);
}
sectorsize = cp->provider->sectorsize;
if (sectorsize < 512)
OpenPOWER on IntegriCloud