drivers/scsi/be2iscsi/be_mgmt.c | 1 + 1 file changed, 1 insertion(+)
If nonemb_cmd->va fails to be allocated, call free_mcc_wrb()
to restore the impact caused by alloc_mcc_wrb().
Fixes: 50a4b824be9e ("scsi: be2iscsi: Fix to make boot discovery non-blocking")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
drivers/scsi/be2iscsi/be_mgmt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 4e899ec1477d..b1cba986f0fb 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1025,6 +1025,7 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba)
&nonemb_cmd->dma,
GFP_KERNEL);
if (!nonemb_cmd->va) {
+ free_mcc_wrb(ctrl, tag);
mutex_unlock(&ctrl->mbox_lock);
return 0;
}
--
2.25.1
On Sat, 13 Dec 2025 16:36:43 +0800, Haoxiang Li wrote:
> If nonemb_cmd->va fails to be allocated, call free_mcc_wrb()
> to restore the impact caused by alloc_mcc_wrb().
>
>
Applied to 6.19/scsi-fixes, thanks!
[1/1] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()
https://git.kernel.org/mkp/scsi/c/4747bafaa501
--
Martin K. Petersen
> If nonemb_cmd->va fails to be allocated, call free_mcc_wrb()
> to restore the impact caused by alloc_mcc_wrb().
avoid?
…
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -1025,6 +1025,7 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba)
> &nonemb_cmd->dma,
> GFP_KERNEL);
> if (!nonemb_cmd->va) {
> + free_mcc_wrb(ctrl, tag);
> mutex_unlock(&ctrl->mbox_lock);
> return 0;
> }
I suggest to avoid also repeated mutex_unlock() calls in this function implementation.
Regards,
Markus
© 2016 - 2026 Red Hat, Inc.