mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: be2iscsi: fix a memleak in beiscsi_init_wrb_handle
@ 2023-11-23  8:19 Dinghao Liu
  2023-11-27 21:26 ` Mike Christie
  2023-12-06  3:15 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2023-11-23  8:19 UTC (permalink / raw)
  To: dinghao.liu
  Cc: Ketan Mukadam, James E.J. Bottomley, Martin K. Petersen,
	John Soni Jose, Jayamohan Kallickal, James Bottomley,
	Mike Christie, linux-scsi, linux-kernel

When an error occurs in the for loop of beiscsi_init_wrb_handle(),
we should free phwi_ctxt->be_wrbq before returning an error code
to prevent potential memleak.

Fixes: a7909b396ba7 ("[SCSI] be2iscsi: Fix dynamic CID allocation Mechanism in driver")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/scsi/be2iscsi/be_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index e48f14ad6dfd..06acb5ff609e 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2710,6 +2710,7 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
 		kfree(pwrb_context->pwrb_handle_base);
 		kfree(pwrb_context->pwrb_handle_basestd);
 	}
+	kfree(phwi_ctxt->be_wrbq);
 	return -ENOMEM;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-06  3:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23  8:19 [PATCH] scsi: be2iscsi: fix a memleak in beiscsi_init_wrb_handle Dinghao Liu
2023-11-27 21:26 ` Mike Christie
2023-12-06  3:15 ` Martin K. Petersen

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

all inboxes | Powered by JetHome®