From: Colin Ian King Date: Sat, 4 Mar 2017 17:30:24 +0000 (-0800) Subject: scsi: lpfc: fix missing spin_unlock on sql_list_lock X-Git-Tag: v4.1.12-106.0.20170720_1900~66 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=80c55d6b7525d90ff6951b42595ffcdc29c18b66;p=users%2Fjedix%2Flinux-maple.git scsi: lpfc: fix missing spin_unlock on sql_list_lock 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 Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Brian Maly --- diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index c65f9396da8a..830555f7f771 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -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. */