Rafael Mendonca dc8e483f68 scsi: lpfc: Fix memory leak in lpfc_create_port()
Commit 5e633302ace1 ("scsi: lpfc: vmid: Add support for VMID in mailbox
command") introduced allocations for the VMID resources in
lpfc_create_port() after the call to scsi_host_alloc(). Upon failure on the
VMID allocations, the new code would branch to the 'out' label, which
returns NULL without unwinding anything, thus skipping the call to
scsi_host_put().

Fix the problem by creating a separate label 'out_free_vmid' to unwind the
VMID resources and make the 'out_put_shost' label call only
scsi_host_put(), as was done before the introduction of allocations for
VMID.

Fixes: 5e633302ace1 ("scsi: lpfc: vmid: Add support for VMID in mailbox command")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Link: https://lore.kernel.org/r/20220916035908.712799-1-rafaelmendsr@gmail.com
Reviewed-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-10-18 02:42:08 +00:00
..
2022-08-04 19:47:37 -07:00
2022-08-04 19:47:37 -07:00
2022-10-07 12:33:18 -07:00
2022-05-23 23:24:10 -04:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-08-04 19:47:37 -07:00
2021-01-22 21:14:08 -05:00
2022-02-22 21:11:02 -05:00
2021-01-22 21:14:08 -05:00
2022-07-26 22:13:29 -04:00
2022-09-01 01:02:10 -04:00
2022-02-22 21:11:02 -05:00
2021-04-13 00:20:48 -04:00
2022-06-27 22:56:21 -04:00
2022-01-25 00:09:41 -05:00
2022-02-22 21:11:02 -05:00
2021-03-24 23:03:43 -04:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-10-07 12:33:18 -07:00
2022-01-22 08:33:37 +02:00
2022-09-01 01:02:10 -04:00
2022-05-08 14:28:18 -04:00
2022-09-30 07:51:13 -06:00
2021-12-22 23:41:13 -05:00
2022-06-28 06:30:26 -06:00
2022-10-07 12:33:18 -07:00
2022-10-10 13:59:01 -07:00
2021-04-13 00:20:48 -04:00
2022-10-07 12:33:18 -07:00