mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()
@ 2025-12-13  8:36 Haoxiang Li
  2025-12-20 16:09 ` Markus Elfring
  2026-01-24  3:53 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-12-13  8:36 UTC (permalink / raw)
  To: ketan.mukadam, James.Bottomley, martin.petersen, jitendra.bhivare, hare
  Cc: linux-scsi, linux-kernel, Haoxiang Li, stable

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


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

* Re: [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()
  2025-12-13  8:36 [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo() Haoxiang Li
@ 2025-12-20 16:09 ` Markus Elfring
  2026-01-24  3:53 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-12-20 16:09 UTC (permalink / raw)
  To: Haoxiang Li, linux-scsi, Hannes Reinecke, James Bottomley,
	Jitendra Bhivare, Ketan Mukadam, Martin K. Petersen
  Cc: stable, LKML

> 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

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

* Re: [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo()
  2025-12-13  8:36 [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo() Haoxiang Li
  2025-12-20 16:09 ` Markus Elfring
@ 2026-01-24  3:53 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-01-24  3:53 UTC (permalink / raw)
  To: ketan.mukadam, James.Bottomley, jitendra.bhivare, hare, Haoxiang Li
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, stable

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

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

end of thread, other threads:[~2026-01-24  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-13  8:36 [PATCH] scsi: be2iscsi: fix a memory leak in beiscsi_boot_get_sinfo() Haoxiang Li
2025-12-20 16:09 ` Markus Elfring
2026-01-24  3:53 ` 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®