From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757370AbdAKTz6 (ORCPT ); Wed, 11 Jan 2017 14:55:58 -0500 Received: from mail-wj0-f179.google.com ([209.85.210.179]:35678 "EHLO mail-wj0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754646AbdAKTzz (ORCPT ); Wed, 11 Jan 2017 14:55:55 -0500 Subject: Re: [PATCH] lpfc: avoid double free of resource identifiers To: Johannes Thumshirn , "Martin K . Petersen" References: <20170111100642.18573-1-jthumshirn@suse.de> Cc: Linux SCSI Mailinglist , Linux Kernel Mailinglist , Dick Kennedy , Roberto Sassu From: James Smart Message-ID: <43af5f62-2e79-62c6-c045-5da0cff18e10@broadcom.com> Date: Wed, 11 Jan 2017 11:47:49 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170111100642.18573-1-jthumshirn@suse.de> Content-Type: text/plain; charset=windows-1252; 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. Thanks Signed-off-by: James Smart -- james On 1/11/2017 2:06 AM, Johannes Thumshirn wrote: > From: Roberto Sassu > > Set variables initialized in lpfc_sli4_alloc_resource_identifiers() to NULL > if an error occurred. Otherwise, lpfc_sli4_driver_resource_unset() attempts > to free the memory again. > > Signed-off-by: Roberto Sassu > Signed-off-by: Johannes Thumshirn > --- > drivers/scsi/lpfc/lpfc_sli.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c > index 4faa767..a78a3df 100644 > --- a/drivers/scsi/lpfc/lpfc_sli.c > +++ b/drivers/scsi/lpfc/lpfc_sli.c > @@ -5954,18 +5954,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) > > free_vfi_bmask: > kfree(phba->sli4_hba.vfi_bmask); > + phba->sli4_hba.vfi_bmask = NULL; > free_xri_ids: > kfree(phba->sli4_hba.xri_ids); > + phba->sli4_hba.xri_ids = NULL; > free_xri_bmask: > kfree(phba->sli4_hba.xri_bmask); > + phba->sli4_hba.xri_bmask = NULL; > free_vpi_ids: > kfree(phba->vpi_ids); > + phba->vpi_ids = NULL; > free_vpi_bmask: > kfree(phba->vpi_bmask); > + phba->vpi_bmask = NULL; > free_rpi_ids: > kfree(phba->sli4_hba.rpi_ids); > + phba->sli4_hba.rpi_ids = NULL; > free_rpi_bmask: > kfree(phba->sli4_hba.rpi_bmask); > + phba->sli4_hba.rpi_bmask = NULL; > err_exit: > return rc; > }