public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Fix memleak on memory alloc failed
@ 2023-05-26 16:19 Jackie Liu
  0 siblings, 0 replies; only message in thread
From: Jackie Liu @ 2023-05-26 16:19 UTC (permalink / raw)
  To: njavali; +Cc: GR-QLogic-Storage-Upstream, linux-scsi

From: Jackie Liu <liuyun01@kylinos.cn>

Returning directly without free memory can lead to memory leaks, which
can be avoided by goto 'fail_dma_pool'.

Fixes: 06634d5b6e92 ("scsi: qla2xxx: Return -ENOMEM if kzalloc() fails")
Reported-by: k2ci <kernel-bot@kylinos.cn>
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2fa695bf38b7..da7698c8293b 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4245,7 +4245,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
 					ql_dbg_pci(ql_dbg_init, ha->pdev,
 					    0xe0ee, "%s: failed alloc dsd\n",
 					    __func__);
-					return -ENOMEM;
+					goto fail_dma_pool;
 				}
 				ha->dif_bundle_kallocs++;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26 16:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-26 16:19 [PATCH] scsi: qla2xxx: Fix memleak on memory alloc failed Jackie Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox