summaryrefslogtreecommitdiffstats
path: root/sys/dev/aac
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2007-12-20 21:13:58 +0000
committeremaste <emaste@FreeBSD.org>2007-12-20 21:13:58 +0000
commit3dd5f00397e99ea9fd6ddd37dd0bae23e05348d6 (patch)
tree662fbc094caf6c4e65b9edbf8f4c80d8f5eedb56 /sys/dev/aac
parent03594bb79f9a6545f49ca5bb2829c5aea7b39011 (diff)
downloadFreeBSD-src-3dd5f00397e99ea9fd6ddd37dd0bae23e05348d6.zip
FreeBSD-src-3dd5f00397e99ea9fd6ddd37dd0bae23e05348d6.tar.gz
Avoid holding the aac_io_lock over copyout.
Submitted by: Achim Leubner @ Adaptec.
Diffstat (limited to 'sys/dev/aac')
-rw-r--r--sys/dev/aac/aac.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c
index 37e13b5a..08ffa9e 100644
--- a/sys/dev/aac/aac.c
+++ b/sys/dev/aac/aac.c
@@ -3017,6 +3017,7 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib)
M_NOWAIT | M_ZERO);
if (event == NULL) {
error = EBUSY;
+ mtx_unlock(&sc->aac_io_lock);
goto out;
}
event->ev_type = AAC_EVENT_CMFREE;
@@ -3048,12 +3049,13 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib)
* Pass the FIB to the controller, wait for it to complete.
*/
mtx_lock(&sc->aac_io_lock);
- if ((error = aac_wait_command(cm)) != 0) {
+ error = aac_wait_command(cm);
+ mtx_unlock(&sc->aac_io_lock);
+ if (error != 0) {
device_printf(sc->aac_dev,
"aac_wait_command return %d\n", error);
goto out;
}
- mtx_unlock(&sc->aac_io_lock);
/*
* Copy the FIB and data back out to the caller.
@@ -3065,14 +3067,13 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib)
size = sizeof(struct aac_fib);
}
error = copyout(cm->cm_fib, ufib, size);
- mtx_lock(&sc->aac_io_lock);
out:
if (cm != NULL) {
+ mtx_lock(&sc->aac_io_lock);
aac_release_command(cm);
+ mtx_unlock(&sc->aac_io_lock);
}
-
- mtx_unlock(&sc->aac_io_lock);
return(error);
}
OpenPOWER on IntegriCloud