diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-02-04 21:44:55 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-02-04 21:44:55 +0000 |
commit | a18d78fa5c6e118934514091c938a5aa2524695d (patch) | |
tree | e9899ff63364af3081b0d7a161a0cb06abcf9fa3 /sys/dev/ic | |
parent | 45bbb3e60425cb31ca89b57b2b8e775c97638385 (diff) |
Close races where timer is started on a command and then an splbio()
is called before the command is started. This might have resulted
in the timeout firing and invalidating the command before it is
started. Move the timeout_add_* inside the relevant splbio()/splx().
ok miod@ tedu@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/iha.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/sili.c | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index dfa2b2a7a63..b01a1a39601 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.41 2012/01/11 16:22:33 dhill Exp $ */ +/* $OpenBSD: iha.c,v 1.42 2012/02/04 21:44:54 krw Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -322,8 +322,6 @@ iha_scsi_cmd(struct scsi_xfer *xs) * But, timeout_add() ONLY if we are not polling. */ timeout_set(&xs->stimeout, iha_timeout, pScb); - if ((pScb->SCB_Flags & SCSI_POLL) == 0) - timeout_add_msec(&xs->stimeout, xs->timeout); iha_exec_scb(sc, pScb); } @@ -2444,12 +2442,16 @@ iha_timeout(void *arg) void iha_exec_scb(struct iha_softc *sc, struct iha_scb *pScb) { + struct scsi_xfer *xs = pScb->SCB_Xs; bus_space_handle_t ioh; bus_space_tag_t iot; int s; s = splbio(); + if ((pScb->SCB_Flags & SCSI_POLL) == 0) + timeout_add_msec(&xs->stimeout, xs->timeout); + if (((pScb->SCB_Flags & SCSI_RESET) != 0) || (pScb->SCB_CDB[0] == REQUEST_SENSE)) iha_push_pend_scb(sc, pScb); /* Insert SCB at head of Pend */ diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index 9fe184e0edf..065699d339f 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili.c,v 1.50 2012/02/04 17:52:22 krw Exp $ */ +/* $OpenBSD: sili.c,v 1.51 2012/02/04 21:44:54 krw Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -1460,8 +1460,8 @@ sili_ata_cmd(struct ata_xfer *xa) if (xa->flags & ATA_F_POLL) sili_poll(ccb, xa->timeout, sili_ata_cmd_timeout); else { - timeout_add_msec(&xa->stimeout, xa->timeout); s = splbio(); + timeout_add_msec(&xa->stimeout, xa->timeout); sili_start(sp, ccb); splx(s); } |