diff options
-rw-r--r-- | sys/geom/geom_dev.c | 3 | ||||
-rw-r--r-- | sys/geom/geom_io.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 1965225..75d3084 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -386,9 +386,6 @@ g_dev_strategy(struct bio *bp) tsleep(&bp, PRIBIO, "gdstrat", hz / 10); } KASSERT(bp2 != NULL, ("XXX: ENOMEM in a bad place")); - KASSERT(bp2->bio_offset >= 0, - ("Negative bio_offset (%jd) on bio %p", - (intmax_t)bp2->bio_offset, bp)); bp2->bio_length = (off_t)bp->bio_bcount; bp2->bio_done = g_dev_done; g_trace(G_T_BIO, diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 31d2296..a01f63b 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -221,7 +221,9 @@ g_io_check(struct bio *bp) /* Reject I/O not integral sector long */ if (bp->bio_length % pp->sectorsize) return (EINVAL); - /* Reject requests past the end of media. */ + /* Reject requests before or past the end of media. */ + if (bp->bio_offset < 0) + return (EIO); if (bp->bio_offset > pp->mediasize) return (EIO); break; |