]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: lpfc: fix missing spin_unlock on sql_list_lock
authorColin Ian King <colin.king@canonical.com>
Sat, 4 Mar 2017 17:30:24 +0000 (09:30 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 14 Jul 2017 00:11:52 +0000 (17:11 -0700)
Orabug: 26439257

In the case where sglq is null, the current code just returns without
unlocking the spinlock sql_list_lock. Fix this by breaking out of the
while loop and the exit path will then unlock and return NULL as was
the original intention.

Detected by CoverityScan, CID#1411635 ("Missing unlock")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c

index c65f9396da8a5a62f567b01f7433a3855e519839..830555f7f7713013eace124043eb991a6337a10f 100644 (file)
@@ -938,8 +938,10 @@ __lpfc_sli_get_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
        start_sglq = sglq;
        while (!found) {
                if (!sglq)
-                       return NULL;
-               if (lpfc_test_rrq_active(phba, ndlp, sglq->sli4_lxritag)) {
+                       break;
+               if (ndlp && ndlp->active_rrqs_xri_bitmap &&
+                   test_bit(sglq->sli4_lxritag,
+                   ndlp->active_rrqs_xri_bitmap)) {
                        /* This xri has an rrq outstanding for this DID.
                         * put it back in the list and get another xri.
                         */