From 3dd5f00397e99ea9fd6ddd37dd0bae23e05348d6 Mon Sep 17 00:00:00 2001 From: emaste Date: Thu, 20 Dec 2007 21:13:58 +0000 Subject: Avoid holding the aac_io_lock over copyout. Submitted by: Achim Leubner @ Adaptec. --- sys/dev/aac/aac.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sys/dev/aac') 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); } -- cgit v1.1