From c5e80142bb7e178c526c2502b0a98233d44e65ad Mon Sep 17 00:00:00 2001 From: ps Date: Tue, 20 Jun 2006 23:08:35 +0000 Subject: [PATCH] Fix a potential problem when mfi_get_log_state and only release a command if one was allocated. Also release the command in mfi_shutdown. --- sys/dev/mfi/mfi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c index e2dfacd9a4a..e46a91606bf 100644 --- a/sys/dev/mfi/mfi.c +++ b/sys/dev/mfi/mfi.c @@ -577,7 +577,7 @@ mfi_get_controller_info(struct mfi_softc *sc) static int mfi_get_log_state(struct mfi_softc *sc, struct mfi_evt_log_state **log_state) { - struct mfi_command *cm; + struct mfi_command *cm = NULL; int error; mtx_lock(&sc->mfi_io_lock); @@ -602,7 +602,8 @@ mfi_get_log_state(struct mfi_softc *sc, struct mfi_evt_log_state **log_state) bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap); out: - mfi_release_command(cm); + if (cm) + mfi_release_command(cm); mtx_unlock(&sc->mfi_io_lock); return (error); @@ -822,6 +823,7 @@ mfi_shutdown(struct mfi_softc *sc) device_printf(sc->mfi_dev, "Failed to shutdown controller\n"); } + mfi_release_command(cm); return (error); } -- 2.45.0