Commit dc8e483
scsi: lpfc: Fix memory leak in lpfc_create_port()
Commit 5e63330 ("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: 5e63330 ("scsi: lpfc: vmid: Add support for VMID in mailbox command")
Signed-off-by: Rafael Mendonca <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: James Smart <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>1 parent 2331ce6 commit dc8e483
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4812 | 4812 | | |
4813 | 4813 | | |
4814 | 4814 | | |
4815 | | - | |
| 4815 | + | |
4816 | 4816 | | |
4817 | 4817 | | |
4818 | 4818 | | |
| |||
4830 | 4830 | | |
4831 | 4831 | | |
4832 | 4832 | | |
4833 | | - | |
| 4833 | + | |
4834 | 4834 | | |
4835 | 4835 | | |
4836 | 4836 | | |
4837 | 4837 | | |
4838 | 4838 | | |
4839 | 4839 | | |
4840 | | - | |
| 4840 | + | |
4841 | 4841 | | |
4842 | 4842 | | |
| 4843 | + | |
4843 | 4844 | | |
4844 | 4845 | | |
4845 | 4846 | | |
| |||
0 commit comments