From 4052863334f88b834ae48faa0160fd6fdd753299 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 18 Dec 2002 19:53:59 +0000 Subject: Balk at unaligned requests. MFC candidate. --- sys/geom/geom_io.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/geom/geom_io.c') diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 165232b..d1c0fe7 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -273,6 +273,16 @@ g_io_request(struct bio *bp, struct g_consumer *cp) case BIO_READ: case BIO_WRITE: case BIO_DELETE: + /* Reject I/O not on sector boundary */ + if (bp->bio_offset % bp->bio_to->sectorsize) { + g_io_deliver(bp, EINVAL); + return; + } + /* Reject I/O not integral sector long */ + if (bp->bio_length % bp->bio_to->sectorsize) { + g_io_deliver(bp, EINVAL); + return; + } /* Reject requests past the end of media. */ if (bp->bio_offset > bp->bio_to->mediasize) { g_io_deliver(bp, EIO); -- cgit v1.1