Commit 04cdaa56 authored by Roberto Sassu's avatar Roberto Sassu Committed by Sasha Levin

scsi: lpfc: avoid double free of resource identifiers

[ Upstream commit cd60be49 ]

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: default avatarRoberto Sassu <rsassu@suse.de>
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Acked-by: default avatarJames Smart <james.smart@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent f73abdbf
...@@ -5887,18 +5887,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) ...@@ -5887,18 +5887,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
free_vfi_bmask: free_vfi_bmask:
kfree(phba->sli4_hba.vfi_bmask); kfree(phba->sli4_hba.vfi_bmask);
phba->sli4_hba.vfi_bmask = NULL;
free_xri_ids: free_xri_ids:
kfree(phba->sli4_hba.xri_ids); kfree(phba->sli4_hba.xri_ids);
phba->sli4_hba.xri_ids = NULL;
free_xri_bmask: free_xri_bmask:
kfree(phba->sli4_hba.xri_bmask); kfree(phba->sli4_hba.xri_bmask);
phba->sli4_hba.xri_bmask = NULL;
free_vpi_ids: free_vpi_ids:
kfree(phba->vpi_ids); kfree(phba->vpi_ids);
phba->vpi_ids = NULL;
free_vpi_bmask: free_vpi_bmask:
kfree(phba->vpi_bmask); kfree(phba->vpi_bmask);
phba->vpi_bmask = NULL;
free_rpi_ids: free_rpi_ids:
kfree(phba->sli4_hba.rpi_ids); kfree(phba->sli4_hba.rpi_ids);
phba->sli4_hba.rpi_ids = NULL;
free_rpi_bmask: free_rpi_bmask:
kfree(phba->sli4_hba.rpi_bmask); kfree(phba->sli4_hba.rpi_bmask);
phba->sli4_hba.rpi_bmask = NULL;
err_exit: err_exit:
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment