[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251113150934.758067-1-zilin@seu.edu.cn>
Date: Thu, 13 Nov 2025 15:09:34 +0000
From: Zilin Guan <zilin@....edu.cn>
To: James.Bottomley@...senPartnership.com
Cc: martin.petersen@...cle.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH] scsi: mvumi: Fix memory leak in mvumi_probe_devices()
In mvumi_probe_devices(), an internal command cmd is allocated via
mvumi_create_internal_cmd() at the beginning of the function.
This command is used within a loop that calls mvumi_match_devices(). If
a device conflict is detected, the function exits immediately without
freeing the cmd allocated at the start, leading to a memory leak.
Fix this by calling mvumi_delete_internal_cmd() to release the command
before returning in this error path.
Fixes: bd756ddea18e0 ("[SCSI] mvumi: Add support for Marvell SAS/SATA RAID-on-Chip(ROC) 88RC9580")
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
drivers/scsi/mvumi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index bdc2f2f17753..9a721608ccea 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -1589,10 +1589,12 @@ static int mvumi_probe_devices(struct mvumi_hba *mhba)
dev_dbg(&mhba->pdev->dev,
"probe a new device(0:%d:0)"
" wwid(%llx)\n", id, mv_dev->wwid);
- } else if (found == -1)
+ } else if (found == -1) {
+ mvumi_delete_internal_cmd(mhba, cmd);
return -1;
- else
+ } else {
continue;
+ }
}
}
--
2.34.1
Powered by blists - more mailing lists