summaryrefslogtreecommitdiffstats
path: root/sys/dev/dpt/dpt_scsi.c
diff options
context:
space:
mode:
authorsmh <smh@FreeBSD.org>2014-11-21 21:01:24 +0000
committersmh <smh@FreeBSD.org>2014-11-21 21:01:24 +0000
commitdd63bf99a2e07e9e0fae2c230c2dc6505f21618d (patch)
tree5ebdafcf9900ec8ee871257dadfca8fdc7f4aa95 /sys/dev/dpt/dpt_scsi.c
parent463d37d4caf476e9ea1220f380eb22393c7fff11 (diff)
downloadFreeBSD-src-dd63bf99a2e07e9e0fae2c230c2dc6505f21618d.zip
FreeBSD-src-dd63bf99a2e07e9e0fae2c230c2dc6505f21618d.tar.gz
Prevent overflow issues in timeout processing
Previously, any timeout value for which (timeout * hz) will overflow the signed integer, will give weird results, since callout(9) routines will convert negative values of ticks to '1'. For unsigned integer overflow we will get sufficiently smaller timeout values than expected. Switch from callout_reset, which requires conversion to int based ticks to callout_reset_sbt to avoid this. Also correct isci to correctly resolve ccb timeout. This was based on the original work done by Eygene Ryabinkin <rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid the overlow. Differential Revision: https://reviews.freebsd.org/D1157 Reviewed by: mav, davide MFC after: 1 month Sponsored by: Multiplay
Diffstat (limited to 'sys/dev/dpt/dpt_scsi.c')
-rw-r--r--sys/dev/dpt/dpt_scsi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c
index 51f9e73d..a31cf79 100644
--- a/sys/dev/dpt/dpt_scsi.c
+++ b/sys/dev/dpt/dpt_scsi.c
@@ -793,8 +793,8 @@ dptexecuteccb(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
dccb->state |= DCCB_ACTIVE;
ccb->ccb_h.status |= CAM_SIM_QUEUED;
LIST_INSERT_HEAD(&dpt->pending_ccb_list, &ccb->ccb_h, sim_links.le);
- callout_reset(&dccb->timer, (ccb->ccb_h.timeout * hz) / 1000,
- dpttimeout, dccb);
+ callout_reset_sbt(&dccb->timer, SBT_1MS * ccb->ccb_h.timeout, 0,
+ dpttimeout, dccb, 0);
if (dpt_send_eata_command(dpt, &dccb->eata_ccb,
dccb->eata_ccb.cp_busaddr,
EATA_CMD_DMA_SEND_CP, 0, 0, 0, 0) != 0) {
OpenPOWER on IntegriCloud