1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

Disallow ATAPI CD transfers that are not a multiple of the device block

size (previously, the transfer size would be rounded up to a multiple of
the block size, which would overflow the buffer).
This fixes panics when doing things like trying to mount audio CD's.

PR:		kern/21946
Review Timeout:	sos
This commit is contained in:
Thomas Moestl 2001-07-29 21:01:13 +00:00
parent 7b22794017
commit 9c4968d152
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80550

View File

@ -1132,7 +1132,11 @@ acd_start(struct atapi_softc *atp)
lastlba = cdp->disk_size;
}
count = (bp->bio_bcount + (blocksize - 1)) / blocksize;
if (bp->bio_bcount % blocksize != 0) {
biofinish(bp, NULL, EINVAL);
return;
}
count = bp->bio_bcount / blocksize;
if (bp->bio_cmd == BIO_READ) {
/* if transfer goes beyond range adjust it to be within limits */