--- a/drivers/infiniband/core/cma.c	2007-10-03 11:24:12.000000000 -0700
+++ b/drivers/infiniband/core/cma.c	2007-10-03 11:27:16.000000000 -0700
@@ -624,6 +624,7 @@ static void cma_destroy_listen(struct rd
 	cma_exch(id_priv, CMA_DESTROYING);
 
 	if (id_priv->cma_dev) {
+		mutex_unlock(&lock);
 		switch (rdma_node_get_transport(id_priv->id.device->node_type)) {
 		case RDMA_TRANSPORT_IB:
 			if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib))
@@ -636,6 +637,7 @@ static void cma_destroy_listen(struct rd
 		default:
 			break;
 		}
+		mutex_lock(&lock);
 		cma_detach_from_dev(id_priv);
 	}
 	list_del(&id_priv->listen_list);
