diff options
author | phk <phk@FreeBSD.org> | 2002-12-17 21:31:58 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-12-17 21:31:58 +0000 |
commit | 51c494ca748e82aa9783781aa6cf477066e63913 (patch) | |
tree | 9ad41a2eb4b6d2fa38efaf80b7b73639f886038a /sys | |
parent | 25073c9645a4b7080edf33ba35f8bcd487991e67 (diff) | |
download | FreeBSD-src-51c494ca748e82aa9783781aa6cf477066e63913.zip FreeBSD-src-51c494ca748e82aa9783781aa6cf477066e63913.tar.gz |
Add a check for negative offset locations and return EINVAL for them.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/geom/geom_slice.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 51d3ffa..c097e7f 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -186,6 +186,11 @@ g_slice_start(struct bio *bp) * method once if so. */ t = bp->bio_offset + gsl->offset; + /* .ctl devices may take us negative */ + if (t < 0 || (t + bp->bio_length) < 0) { + g_io_deliver(bp, EINVAL); + return; + } for (m_index = 0; m_index < gsp->nhot; m_index++) { gmp = &gsp->hot[m_index]; if (t >= gmp->offset + gmp->length) |