[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251229152938.481054-1-zilin@seu.edu.cn>
Date: Mon, 29 Dec 2025 15:29:38 +0000
From: Zilin Guan <zilin@....edu.cn>
To: don.brace@...rochip.com
Cc: James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com,
storagedev@...rochip.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zilin Guan <zilin@....edu.cn>,
Jianhao Xu <jianhao.xu@....edu.cn>
Subject: [PATCH] scsi: hpsa: Fix memory leak in hpsa_undo_allocations_after_kdump_soft_reset()
The h->reply_map is allocated in hpda_alloc_ctlr_info() via kcalloc().
If the controller reset fails during initialization in hpsa_init_one(),
hpsa_undo_allocations_after_kdump_soft_reset() is called to clean up
resources. However, this function frees the controller structure h but
fails to free h->reply_map, leading to a memory leak.
Fix this by freeing h->reply_map before freeing h in the cleanup function.
Fixes: 8b834bff1b73 ("scsi: hpsa: fix selection of reply queue")
Co-developed-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
drivers/scsi/hpsa.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3654b12c5d5a..c35d7b097252 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -8212,6 +8212,8 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
h->monitor_ctlr_wq = NULL;
}
+ kfree(h->reply_map); /* init_one 1 */
+ h->reply_map = NULL; /* init_one 1 */
kfree(h); /* init_one 1 */
}
--
2.34.1
Powered by blists - more mailing lists