linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock
@ 2017-02-24 14:30 Colin King
  2017-03-04 17:42 ` James Smart
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-02-24 14:30 UTC (permalink / raw)
  To: James Smart, Dick Kennedy, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 1fba5dc..40720bb 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -952,7 +952,7 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
 	start_sglq = sglq;
 	while (!found) {
 		if (!sglq)
-			return NULL;
+			break;
 		if (ndlp && ndlp->active_rrqs_xri_bitmap &&
 		    test_bit(sglq->sli4_lxritag,
 		    ndlp->active_rrqs_xri_bitmap)) {
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock
  2017-02-24 14:30 [PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock Colin King
@ 2017-03-04 17:42 ` James Smart
  0 siblings, 0 replies; 2+ messages in thread
From: James Smart @ 2017-03-04 17:42 UTC (permalink / raw)
  To: Colin King, Dick Kennedy, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

Looks good. I included it in the lpfc patch set just posted.

-- james


On 2/24/2017 6:30 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
> ---
>   drivers/scsi/lpfc/lpfc_sli.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index 1fba5dc..40720bb 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -952,7 +952,7 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
>   	start_sglq = sglq;
>   	while (!found) {
>   		if (!sglq)
> -			return NULL;
> +			break;
>   		if (ndlp && ndlp->active_rrqs_xri_bitmap &&
>   		    test_bit(sglq->sli4_lxritag,
>   		    ndlp->active_rrqs_xri_bitmap)) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-04 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 14:30 [PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock Colin King
2017-03-04 17:42 ` James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).