svn commit: r231092 - head/sys/cam/ctl

Ed Maste emaste at FreeBSD.org
Mon Feb 6 18:11:00 UTC 2012


Author: emaste
Date: Mon Feb  6 18:11:00 2012
New Revision: 231092
URL: http://svn.freebsd.org/changeset/base/231092

Log:
  Avoid panic from unlocking a not locked mutex (in some error cases).
  
  Reviewed by:	ken@

Modified:
  head/sys/cam/ctl/ctl_frontend_cam_sim.c

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c	Mon Feb  6 17:59:14 2012	(r231091)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c	Mon Feb  6 18:11:00 2012	(r231092)
@@ -221,6 +221,7 @@ cfcs_init(void)
 
 	mtx_lock(&softc->lock);
 	if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) {
+		mtx_unlock(&softc->lock);
 		printf("%s: error registering SIM\n", __func__);
 		retval = ENOMEM;
 		goto bailout;
@@ -230,6 +231,7 @@ cfcs_init(void)
 			    cam_sim_path(softc->sim),
 			    CAM_TARGET_WILDCARD,
 			    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+		mtx_unlock(&softc->lock);
 		printf("%s: error creating path\n", __func__);
 		xpt_bus_deregister(cam_sim_path(softc->sim));
 		retval = 1;
@@ -253,8 +255,6 @@ bailout:
 	else if (softc->devq)
 		cam_simq_free(softc->devq);
 
-	mtx_unlock(&softc->lock);
-
 	return (retval);
 }
 


More information about the svn-src-head mailing list