From 8e8018571fa3f5fc1eae5934a8d72b0217bd5e6b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 4 May 2012 16:06:08 +0000 Subject: [PATCH] ib_srpt: Test earlier during login whether a port has been disabled (merge r4282 from trunk). git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4283 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index bb09b000b..4dfa5d488 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2530,6 +2530,16 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, spin_lock_irq(&sdev->spinlock); + if (!sdev->enabled) { + rej->reason = cpu_to_be32( + SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); + PRINT_ERROR("rejected SRP_LOGIN_REQ because the target %s (%s)" + " is not enabled", + sdev->scst_tgt->tgt_name, sdev->device->name); + spin_unlock_irq(&sdev->spinlock); + goto reject; + } + if ((req->req_flags & SRP_MTCH_ACTION) == SRP_MULTICHAN_SINGLE) { struct srpt_rdma_ch *ch2; @@ -2560,16 +2570,6 @@ restart: list_add_tail(&ch->list, &sdev->rch_list); ch->thread = thread; - if (!sdev->enabled) { - rej->reason = cpu_to_be32( - SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); - PRINT_ERROR("rejected SRP_LOGIN_REQ because the target %s (%s)" - " is not enabled", - sdev->scst_tgt->tgt_name, sdev->device->name); - spin_unlock_irq(&sdev->spinlock); - goto reject; - } - spin_unlock_irq(&sdev->spinlock); ret = srpt_ch_qp_rtr(ch, ch->qp); @@ -2641,6 +2641,7 @@ free_ring: free_ch: cm_id->context = NULL; kfree(ch); + ch = NULL; BUG_ON(ret == 0);