[PATCH] scsi: be2iscsi: fix memory leak on beiscsi_init_sliport() error path
From: Dawei Feng
Date: Mon Jun 08 2026 - 10:29:23 EST
In beiscsi_dev_probe(), jumping to free_hba after a beiscsi_init_sliport()
failure skips cleanup for resources allocated by be_ctrl_init().
Fix this by changing the error jump to free_port, ensuring the DMA buffer
and PCI mappings are safely released.
The bug was first flagged by an experimental analysis tool we are
developing for kernel memory-management bugs while analyzing
v6.13-rc1. The tool is still under development and is not yet publicly
available. Manual inspection confirms that the bug is still
present in v7.1-rc7.
An x86_64 allyesconfig build showed no new warnings. As we do not have an
Emulex OneConnect 10Gbps iSCSI adapter to test with, no runtime testing
was able to be performed.
Fixes: 4d2ee1e688a26 ("scsi: be2iscsi: Fix POST check and reset sequence")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Zilin Guan <zilin@xxxxxxxxxx>
Signed-off-by: Dawei Feng <dawei.feng@xxxxxxxxxx>
---
drivers/scsi/be2iscsi/be_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index fd18d4d3d219..6d69748961b0 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5568,7 +5568,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
ret = beiscsi_init_sliport(phba);
if (ret)
- goto free_hba;
+ goto free_port;
spin_lock_init(&phba->io_sgl_lock);
spin_lock_init(&phba->mgmt_sgl_lock);
--
2.34.1