diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2013-12-04 05:21:58 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2013-12-04 05:21:58 +0000 |
commit | 7aedf74aab64d02ad1a0008e549872557779dd8c (patch) | |
tree | e3cc0452b313af1c4ff24e408e557607675d7bbf | |
parent | fd0e49fcaeb0f1c70aca27ca1f8fecb746118ac0 (diff) |
mfi_refresh_sensors calls mfi_ioctl_vol which calls mfi_bio_getitall, which
replaces pointers in the softc and all sorts of fun stuff. this protects
the call to bio_getitall with the sc_lock the ioctl path uses, so we dont
get panics like those reported on bugs@ recently.
ok deraadt@
-rw-r--r-- | sys/dev/ic/mfi.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 80914423956..e73ccf2d33a 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.148 2013/10/23 13:05:38 kettenis Exp $ */ +/* $OpenBSD: mfi.c,v 1.149 2013/12/04 05:21:57 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -2200,7 +2200,7 @@ void mfi_refresh_sensors(void *arg) { struct mfi_softc *sc = arg; - int i; + int i, rv; struct bioc_vol bv; if (sc->sc_bbu != NULL && mfi_bbu(sc) != 0) @@ -2209,7 +2209,12 @@ mfi_refresh_sensors(void *arg) for (i = 0; i < sc->sc_ld_cnt; i++) { bzero(&bv, sizeof(bv)); bv.bv_volid = i; - if (mfi_ioctl_vol(sc, &bv)) + + rw_enter_write(&sc->sc_lock); + rv = mfi_ioctl_vol(sc, &bv); + rw_exit_write(&sc->sc_lock); + + if (rv != 0) return; switch(bv.bv_status) { |