mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: esas2r: fix a resource leak in esas2r_resume()
@ 2025-12-23 14:15 Haoxiang Li
  2025-12-29 15:27 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2025-12-23 14:15 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen, JBottomley
  Cc: linux-scsi, linux-kernel, Haoxiang Li, stable

Add esas2r_unmap_regions() to release the resources
allocated by esas2r_map_regions() in some error paths.

Found by code review and compiled on ubuntu 20.04.

Fixes: 26780d9e12ed ("[SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/scsi/esas2r/esas2r_init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 04a07fe57be2..114239373f28 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -684,7 +684,7 @@ static int __maybe_unused esas2r_resume(struct device *dev)
 	if (!esas2r_power_up(a, true)) {
 		esas2r_debug("yikes, esas2r_power_up failed");
 		rez = -ENOMEM;
-		goto error_exit;
+		goto error_unmap;
 	}
 
 	esas2r_claim_interrupts(a);
@@ -700,9 +700,11 @@ static int __maybe_unused esas2r_resume(struct device *dev)
 		esas2r_debug("yikes, unable to claim IRQ");
 		esas2r_log(ESAS2R_LOG_CRIT, "could not re-claim IRQ!");
 		rez = -ENOMEM;
-		goto error_exit;
+		goto error_unmap;
 	}
 
+error_unmap:
+	esas2r_unmap_regions(a);
 error_exit:
 	esas2r_log_dev(ESAS2R_LOG_CRIT, dev, "esas2r_resume(): %d",
 		       rez);
-- 
2.25.1


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

end of thread, other threads:[~2025-12-29 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-23 14:15 [PATCH] scsi: esas2r: fix a resource leak in esas2r_resume() Haoxiang Li
2025-12-29 15:27 ` Markus Elfring

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®