diff options
author | sos <sos@FreeBSD.org> | 2000-01-07 12:01:01 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2000-01-07 12:01:01 +0000 |
commit | e27e6546b6b4db784cc995f88f0dbc78983b9e34 (patch) | |
tree | 108d074ddec1f605a4d48b96d46ea7deb22ea4b9 | |
parent | 5bcc2e4ffea6487b318aae68394a8cff50d607d4 (diff) | |
download | FreeBSD-src-e27e6546b6b4db784cc995f88f0dbc78983b9e34.zip FreeBSD-src-e27e6546b6b4db784cc995f88f0dbc78983b9e34.tar.gz |
Guard against transfers of zero length given to *strategy.
-rw-r--r-- | sys/dev/ata/ata-disk.c | 7 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 9 |
3 files changed, 16 insertions, 2 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 598d6df..619f1fe 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -301,6 +301,13 @@ adstrategy(struct buf *bp) struct ad_softc *adp = bp->b_dev->si_drv1; int32_t s; + /* if it's a null transfer, return immediatly. */ + if (bp->b_bcount == 0) { + bp->b_resid = 0; + biodone(bp); + return; + } + s = splbio(); bufqdisksort(&adp->queue, bp); ad_start(adp); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 40eb4b6..50632f7 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -1030,7 +1030,7 @@ acdstrategy(struct buf *bp) return; } #endif - + /* if it's a null transfer, return immediatly. */ if (bp->b_bcount == 0) { bp->b_resid = 0; biodone(bp); diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 6c45f6f..f8e3291 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -254,6 +254,13 @@ afdstrategy(struct buf *bp) struct afd_softc *fdp = bp->b_dev->si_drv1; int32_t s; + /* if it's a null transfer, return immediatly. */ + if (bp->b_bcount == 0) { + bp->b_resid = 0; + biodone(bp); + return; + } + s = splbio(); bufq_insert_tail(&fdp->buf_queue, bp); afd_start(fdp); @@ -267,7 +274,7 @@ afd_start(struct afd_softc *fdp) u_int32_t lba, count; int8_t ccb[16]; int8_t *data_ptr; - + if (!bp) return; |