1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

g_io_check: respond to zero pp->mediasize with ENXIO

Previsouly this condition was reported with EIO by bio_offset > mediasize
check.
Perhaps that check should be extended to bio_offset+bio_length > mediasize.

MFC after:	1 week
This commit is contained in:
Andriy Gapon 2010-04-15 08:39:56 +00:00
parent fdfa00ba83
commit 2a842317eb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206650

View File

@ -309,8 +309,8 @@ g_io_check(struct bio *bp)
case BIO_READ:
case BIO_WRITE:
case BIO_DELETE:
/* Zero sectorsize is a probably lack of media */
if (pp->sectorsize == 0)
/* Zero sectorsize or mediasize is probably a lack of media. */
if (pp->sectorsize == 0 || pp->mediasize == 0)
return (ENXIO);
/* Reject I/O not on sector boundary */
if (bp->bio_offset % pp->sectorsize)