diff options
author | peter <peter@FreeBSD.org> | 1996-08-02 06:10:49 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-08-02 06:10:49 +0000 |
commit | 29c65f94fc020b904d22c2d62c0fd3441a8a43fd (patch) | |
tree | 453571cf75301f95d4ea073cb1b94fc3c4ec1edc /sys/scsi/sd.c | |
parent | 6d6a5bd8e18385ece6b7f53423e560479bc9b796 (diff) | |
download | FreeBSD-src-29c65f94fc020b904d22c2d62c0fd3441a8a43fd.zip FreeBSD-src-29c65f94fc020b904d22c2d62c0fd3441a8a43fd.tar.gz |
The sd and od drivers didn't check for negative block numbers (like wd.c
does) before calling dscheck(). dscheck() doesn't appreciate this and
calls Debugger() and returns without setting bp->b_error.
This can happen when there is a casting error and offsets > 2G are
converted to negative off_t's in the disk tools. (dumpfs used to do this).
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r-- | sys/scsi/sd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index edbce2c..a6b066b 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.90 1996/06/14 11:02:20 asami Exp $ + * $Id: sd.c,v 1.91 1996/07/23 21:52:27 phk Exp $ */ #include "opt_bounce.h" @@ -430,9 +430,9 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link) scsi_minphys(bp,&sd_switch); /* - * Odd number of bytes + * Odd number of bytes or negative offset */ - if (bp->b_bcount % DEV_BSIZE != 0) { + if (bp->b_blkno < 0 || bp->b_bcount % DEV_BSIZE != 0) { bp->b_error = EINVAL; goto bad; } |