diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-12-18 19:53:59 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-12-18 19:53:59 +0000 |
commit | 0ae8896ed2e5636464b3710b719779a6dc083468 (patch) | |
tree | a920c24bfb11e6964a9d1107f976987838a681e1 /sys/geom/geom_io.c | |
parent | 4c572f622231e2e71cdb7564461fd3064d81d52f (diff) | |
download | src-0ae8896ed2e5636464b3710b719779a6dc083468.tar.gz src-0ae8896ed2e5636464b3710b719779a6dc083468.zip |
Balk at unaligned requests.
MFC candidate.
Notes
Notes:
svn path=/head/; revision=108051
Diffstat (limited to 'sys/geom/geom_io.c')
-rw-r--r-- | sys/geom/geom_io.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 165232b8ec62..d1c0fe7c4d0a 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); |