From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbdCDRm7 (ORCPT ); Sat, 4 Mar 2017 12:42:59 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36153 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbdCDRm4 (ORCPT ); Sat, 4 Mar 2017 12:42:56 -0500 Subject: Re: [PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock To: Colin King , Dick Kennedy , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org References: <20170224143015.6441-1-colin.king@canonical.com> Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org From: James Smart Message-ID: <4692bdb2-dabb-a9bb-90f3-0678ab0fd26e@broadcom.com> Date: Sat, 4 Mar 2017 09:42:50 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20170224143015.6441-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > --- > 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)) {