[SCSI] be2iscsi: Fix the MCCQ count leakage
authorJayamohan Kallickal <jayamohank@gmail.com>
Sat, 28 Sep 2013 22:35:39 +0000 (15:35 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 25 Oct 2013 08:58:04 +0000 (09:58 +0100)
When MBX CMD is posted in MCCQ and if command times out,during
mccq resource cleanup for the timed out command  mccq->count
was not decremented. The led to BUG_ON being hit.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_cmds.c

index bb70dcb493c667b055119385fb93719a928d91d6..f7788e59c3f2d97425f4bec0a5ae485e7426bd06 100644 (file)
@@ -174,6 +174,10 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
                            BEISCSI_LOG_CONFIG,
                            "BC_%d : MBX Cmd Completion timed out\n");
                rc = -EAGAIN;
+
+               /* decrement the mccq used count */
+               atomic_dec(&phba->ctrl.mcc_obj.q.used);
+
                goto release_mcc_tag;
        } else
                rc = 0;
@@ -699,7 +703,7 @@ struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
        struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
        struct be_mcc_wrb *wrb;
 
-       BUG_ON(atomic_read(&mccq->used) >= mccq->len);
+       WARN_ON(atomic_read(&mccq->used) >= mccq->len);
        wrb = queue_head_node(mccq);
        memset(wrb, 0, sizeof(*wrb));
        wrb->tag0 = (mccq->head & 0x000000FF) << 16;