[PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()

Haoxiang Li posted 1 patch 17 hours ago
drivers/scsi/be2iscsi/be_mgmt.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()
Posted by Haoxiang Li 17 hours ago
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