summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-11-22 03:19:51 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-11-22 03:19:51 +0000
commitdd60d074759322d15acf383d92c730ab54b92dff (patch)
tree0eba06b69bab468f124670fae64d2eede77654ad
parent926ed21a0dd6305a8fbfcea7291cde5f604928af (diff)
Ooops. Don't de-reference st until after it has been pointed at the
correct st_softc. Fixes 'mt rewoffl' panics, as reported on misc@ by Jeff Ross and reproduced on my tape machine.
-rw-r--r--sys/scsi/st.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index f59332646fc..0a8ebae947b 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.77 2007/11/16 11:28:34 deraadt Exp $ */
+/* $OpenBSD: st.c,v 1.78 2007/11/22 03:19:50 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -1130,17 +1130,18 @@ stioctl(dev, cmd, arg, flag, p)
struct mtop *mt = (struct mtop *) arg;
int number;
- if (st->flags & ST_DYING) {
- device_unref(&st->sc_dev);
- return (ENXIO);
- }
-
/*
* Find the device that the user is talking about
*/
flags = 0; /* give error messages, act on errors etc. */
unit = STUNIT(dev);
st = st_cd.cd_devs[unit];
+
+ if (st->flags & ST_DYING) {
+ device_unref(&st->sc_dev);
+ return (ENXIO);
+ }
+
hold_blksize = st->blksize;
hold_density = st->density;