mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
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).
This commit is contained in:
parent
8566830b43
commit
2176b02c56
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17390
@ -28,7 +28,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: od.c,v 1.18 1996/06/16 19:58:24 joerg Exp $
|
||||
* $Id: od.c,v 1.19 1996/07/23 21:52:22 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -486,9 +486,9 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user