| From foo@baz Mon Jul 3 13:29:24 CEST 2017 |
| From: Roberto Sassu <rsassu@suse.de> |
| Date: Wed, 11 Jan 2017 11:06:42 +0100 |
| Subject: scsi: lpfc: avoid double free of resource identifiers |
| |
| From: Roberto Sassu <rsassu@suse.de> |
| |
| |
| [ 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> |
| --- |
| drivers/scsi/lpfc/lpfc_sli.c | 7 +++++++ |
| 1 file changed, 7 insertions(+) |
| |
| --- a/drivers/scsi/lpfc/lpfc_sli.c |
| +++ b/drivers/scsi/lpfc/lpfc_sli.c |
| @@ -5887,18 +5887,25 @@ lpfc_sli4_alloc_resource_identifiers(str |
| |
| 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; |
| } |