Skip to content

Commit be91b09

Browse files
rsassugregkh
authored andcommitted
scsi: lpfc: avoid double free of resource identifiers
[ Upstream commit cd60be4916ae689387d04b86b6fc15931e4c95ae ] 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 <rsassu@suse.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4ac60b2 commit be91b09

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,18 +5887,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
58875887

58885888
free_vfi_bmask:
58895889
kfree(phba->sli4_hba.vfi_bmask);
5890+
phba->sli4_hba.vfi_bmask = NULL;
58905891
free_xri_ids:
58915892
kfree(phba->sli4_hba.xri_ids);
5893+
phba->sli4_hba.xri_ids = NULL;
58925894
free_xri_bmask:
58935895
kfree(phba->sli4_hba.xri_bmask);
5896+
phba->sli4_hba.xri_bmask = NULL;
58945897
free_vpi_ids:
58955898
kfree(phba->vpi_ids);
5899+
phba->vpi_ids = NULL;
58965900
free_vpi_bmask:
58975901
kfree(phba->vpi_bmask);
5902+
phba->vpi_bmask = NULL;
58985903
free_rpi_ids:
58995904
kfree(phba->sli4_hba.rpi_ids);
5905+
phba->sli4_hba.rpi_ids = NULL;
59005906
free_rpi_bmask:
59015907
kfree(phba->sli4_hba.rpi_bmask);
5908+
phba->sli4_hba.rpi_bmask = NULL;
59025909
err_exit:
59035910
return rc;
59045911
}

0 commit comments

Comments
 (0)