summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-01-31 23:15:36 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-01-31 23:15:36 +0000
commitf7e4cf6cd46aa509e565a3739beada3c526da7ec (patch)
tree143630a9e74dd140fe21faad85ca04d450289f15 /sys/dev/ic
parentb0e7c8706d95706b5b6b546984b75edc904d6cd5 (diff)
scsi_done() is unsafe, rearrange locking to compensate
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/twe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c
index bc4665bf8a6..5cf3ce07293 100644
--- a/sys/dev/ic/twe.c
+++ b/sys/dev/ic/twe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: twe.c,v 1.15 2001/12/06 09:30:31 mickey Exp $ */
+/* $OpenBSD: twe.c,v 1.16 2002/01/31 23:15:35 mickey Exp $ */
/*
* Copyright (c) 2000, 2001 Michael Shalayeff. All rights reserved.
@@ -672,13 +672,13 @@ twe_done(sc, idx)
lock = TWE_LOCK_TWE(sc);
TAILQ_REMOVE(&sc->sc_ccbq, ccb, ccb_link);
twe_put_ccb(ccb);
- TWE_UNLOCK_TWE(sc, lock);
if (xs) {
xs->resid = 0;
xs->flags |= ITSDONE;
scsi_done(xs);
}
+ TWE_UNLOCK_TWE(sc, lock);
return 0;
}
@@ -855,12 +855,12 @@ twe_scsi_cmd(xs)
}
if (blockno >= sc->sc_hdr[target].hd_size ||
blockno + blockcnt > sc->sc_hdr[target].hd_size) {
- TWE_UNLOCK_TWE(sc, lock);
printf("%s: out of bounds %u-%u >= %u\n",
sc->sc_dev.dv_xname, blockno, blockcnt,
sc->sc_hdr[target].hd_size);
xs->error = XS_DRIVER_STUFFUP;
scsi_done(xs);
+ TWE_UNLOCK_TWE(sc, lock);
return (COMPLETE);
}
}
@@ -874,9 +874,9 @@ twe_scsi_cmd(xs)
}
if ((ccb = twe_get_ccb(sc)) == NULL) {
- TWE_UNLOCK_TWE(sc, lock);
xs->error = XS_DRIVER_STUFFUP;
scsi_done(xs);
+ TWE_UNLOCK_TWE(sc, lock);
return (COMPLETE);
}