From 8948179aba5423d5166f838fae3db145b2c8ccae Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Tue, 6 Nov 2018 15:55:41 +0000 Subject: [PATCH] Don't allow BIO_READ, BIO_WRITE or BIO_DELETE requests that are fully beyond the end of providers media. The only exception is made for the zero length transfers which are allowed to be just on the boundary. Previously, any requests starting on the boundary (i.e. next byte after the last one) have been allowed to go through. No response from: freebsd-geom@, phk MFC after: 1 month --- sys/geom/geom_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 9797884252ef..8a35b1e57d00 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -420,6 +420,8 @@ g_io_check(struct bio *bp) return (EIO); if (bp->bio_offset > pp->mediasize) return (EIO); + if (bp->bio_offset == pp->mediasize && bp->bio_length > 0) + return (EIO); /* Truncate requests to the end of providers media. */ excess = bp->bio_offset + bp->bio_length;