android_kernel_samsung_sm8650/drivers/scsi/qla2xxx
Li Zetao 44374911ac scsi: qla2xxx: Fix memory leak in qla2x00_probe_one()
[ Upstream commit 85ade4010e13ef152ea925c74d94253db92e5428 ]

There is a memory leak reported by kmemleak:

  unreferenced object 0xffffc900003f0000 (size 12288):
    comm "modprobe", pid 19117, jiffies 4299751452 (age 42490.264s)
    hex dump (first 32 bytes):
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<00000000629261a8>] __vmalloc_node_range+0xe56/0x1110
      [<0000000001906886>] __vmalloc_node+0xbd/0x150
      [<000000005bb4dc34>] vmalloc+0x25/0x30
      [<00000000a2dc1194>] qla2x00_create_host+0x7a0/0xe30 [qla2xxx]
      [<0000000062b14b47>] qla2x00_probe_one+0x2eb8/0xd160 [qla2xxx]
      [<00000000641ccc04>] local_pci_probe+0xeb/0x1a0

The root cause is traced to an error-handling path in qla2x00_probe_one()
when the adapter "base_vha" initialize failed. The fab_scan_rp "scan.l" is
used to record the port information and it is allocated in
qla2x00_create_host(). However, it is not released in the error handling
path "probe_failed".

Fix this by freeing the memory of "scan.l" when an error occurs in the
adapter initialization process.

Fixes: a4239945b8 ("scsi: qla2xxx: Add switch command to simplify fabric discovery")
Signed-off-by: Li Zetao <lizetao1@huawei.com>
Link: https://lore.kernel.org/r/20230325110004.363898-1-lizetao1@huawei.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-13 16:55:31 +02:00
..
Kconfig
Makefile scsi: qla2xxx: edif: Add start + stop bsgs 2021-07-27 00:06:42 -04:00
qla_attr.c scsi: qla2xxx: Use transport-defined speed mask for supported_speeds 2022-10-01 05:54:07 -04:00
qla_bsg.c scsi: qla2xxx: Check if port is online before sending ELS 2023-03-10 09:34:28 +01:00
qla_bsg.h scsi: qla2xxx: Add NVMe parameters support in Auxiliary Image Status 2022-09-01 00:30:55 -04:00
qla_dbg.c scsi: qla2xxx: Enhance driver tracing with separate tunable and more 2022-09-01 00:30:55 -04:00
qla_dbg.h scsi: qla2xxx: Enhance driver tracing with separate tunable and more 2022-09-01 00:30:55 -04:00
qla_def.h scsi: qla2xxx: Fix exchange oversubscription 2023-03-10 09:33:12 +01:00
qla_devtbl.h
qla_dfs.c scsi: qla2xxx: Fix exchange oversubscription for management commands 2023-03-10 09:33:12 +01:00
qla_dsd.h
qla_edif_bsg.h scsi: qla2xxx: edif: Fix clang warning 2023-03-10 09:33:12 +01:00
qla_edif.c scsi: qla2xxx: edif: Fix clang warning 2023-03-10 09:33:12 +01:00
qla_edif.h scsi: qla2xxx: edif: Fix session thrash 2022-06-10 13:04:04 -04:00
qla_fw.h scsi: qla2xxx: Add NVMe parameters support in Auxiliary Image Status 2022-09-01 00:30:55 -04:00
qla_gbl.h scsi: qla2xxx: Add option to disable FC2 Target support 2023-03-30 12:49:17 +02:00
qla_gs.c scsi: qla2xxx: Update manufacturer details 2022-07-18 22:33:04 -04:00
qla_init.c scsi: qla2xxx: Add option to disable FC2 Target support 2023-03-30 12:49:17 +02:00
qla_inline.h scsi: qla2xxx: Fix exchange oversubscription for management commands 2023-03-10 09:33:12 +01:00
qla_iocb.c scsi: qla2xxx: Fix exchange oversubscription for management commands 2023-03-10 09:33:12 +01:00
qla_isr.c scsi: qla2xxx: Synchronize the IOCB count to be in order 2023-03-30 12:49:13 +02:00
qla_mbx.c scsi: qla2xxx: Fix discovery issues in FC-AL topology 2022-07-18 22:33:03 -04:00
qla_mid.c scsi: qla2xxx: edif: Synchronize NPIV deletion with authentication application 2022-06-07 21:50:10 -04:00
qla_mr.c scsi: qla2xxx: Implement ref count for SRB 2022-01-24 23:57:30 -05:00
qla_mr.h
qla_nvme.c scsi: qla2xxx: Fix DMA-API call trace on NVMe LS requests 2023-03-10 09:34:28 +01:00
qla_nvme.h scsi: qla2xxx: Increase max limit of ql2xnvme_queues 2022-03-15 00:29:15 -04:00
qla_nx2.c scsi: qla2xxx: Use named initializers for q_dev_state 2022-02-22 21:11:07 -05:00
qla_nx2.h
qla_nx.c scsi: qla2xxx: Use named initializers for q_dev_state 2022-02-22 21:11:07 -05:00
qla_nx.h scsi: qla2xxx: Use named initializers for q_dev_state 2022-02-22 21:11:07 -05:00
qla_os.c scsi: qla2xxx: Fix memory leak in qla2x00_probe_one() 2023-04-13 16:55:31 +02:00
qla_settings.h
qla_sup.c scsi: qla2xxx: Add devids and conditionals for 28xx 2022-01-24 23:57:32 -05:00
qla_target.c SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
qla_target.h scsi: qla2xxx: Remove unused declarations for qla2xxx 2022-09-15 21:46:46 -04:00
qla_tmpl.c scsi: qla2xxx: Fix premature hw access after PCI error 2022-01-24 23:57:30 -05:00
qla_tmpl.h
qla_version.h scsi: qla2xxx: Update version to 10.02.07.900-k 2022-09-01 00:30:56 -04:00
tcm_qla2xxx.c scsi: target: qla2xxx: Replace enable attr with ops.enable 2021-10-04 23:27:38 -04:00
tcm_qla2xxx.h