|Both, the wd and the sd driver do not reject invalid request of odd

|sizes. They simply pass them to the disks, which usually causes
|fatal errors then.
This commit is contained in:
Joerg Wunsch 1994-11-03 18:20:15 +00:00
parent c7aed1527d
commit f73af18476
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4120
2 changed files with 11 additions and 3 deletions

View File

@ -37,7 +37,7 @@ static int wdtest = 0;
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.57 1994/10/27 05:39:12 phk Exp $
* $Id: wd.c,v 1.58 1994/10/27 20:44:52 jkh Exp $
*/
/* TODO:
@ -456,7 +456,8 @@ wdstrategy(register struct buf *bp)
int s;
/* valid unit, controller, and request? */
if (lunit >= NWD || bp->b_blkno < 0 || (du = wddrives[lunit]) == NULL) {
if (lunit >= NWD || bp->b_blkno < 0 || (du = wddrives[lunit]) == NULL
|| bp->b_bsize % DEV_BSIZE != 0) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
* $Id: sd.c,v 1.38 1994/10/27 20:45:04 jkh Exp $
* $Id: sd.c,v 1.39 1994/10/31 23:45:40 phk Exp $
*/
#define SPLSD splbio
@ -440,6 +440,13 @@ sdstrategy(bp)
if (bp->b_bcount == 0) {
goto done;
}
/*
* Odd number of bytes
*/
if (bp->b_bcount % DEV_BSIZE != 0) {
bp->b_error = EINVAL;
goto bad;
}
/*
* Decide which unit and partition we are talking about
* only raw is ok if no label