summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_slice.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-12-17 21:31:58 +0000
committerphk <phk@FreeBSD.org>2002-12-17 21:31:58 +0000
commit51c494ca748e82aa9783781aa6cf477066e63913 (patch)
tree9ad41a2eb4b6d2fa38efaf80b7b73639f886038a /sys/geom/geom_slice.c
parent25073c9645a4b7080edf33ba35f8bcd487991e67 (diff)
downloadFreeBSD-src-51c494ca748e82aa9783781aa6cf477066e63913.zip
FreeBSD-src-51c494ca748e82aa9783781aa6cf477066e63913.tar.gz
Add a check for negative offset locations and return EINVAL for them.
Diffstat (limited to 'sys/geom/geom_slice.c')
-rw-r--r--sys/geom/geom_slice.c5
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)
OpenPOWER on IntegriCloud