Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: esas2r: fix refcount leak in esas2r_resume()
@ 2026-06-11  6:41 WenTao Liang
  2026-06-11  6:53 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-11  6:41 UTC (permalink / raw)
  To: linuxdrivers, James.Bottomley, martin.petersen
  Cc: linux-scsi, linux-kernel, WenTao Liang, stable

In esas2r_resume(), the function unconditionally calls
esas2r_disable_chip_interrupts() which increments the adapter's
dis_ints_cnt atomic counter. The counter is supposed to be
decremented by esas2r_enable_chip_interrupts(), but this only
happens on the success path when AF2_IRQ_CLAIMED is set. If
esas2r_power_up() fails or AF2_IRQ_CLAIMED is not set, the
function returns via error_exit without calling
esas2r_enable_chip_interrupts(), leaving the counter permanently
incremented. This refcount leak means the next disable/enable
cycle will not properly unmask interrupts (counter goes 1->2 on
disable, 2->1 on enable, never reaching 0), breaking interrupt
operation.

Fix it by calling esas2r_enable_chip_interrupts() before jumping
to error_exit on both error paths.

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

diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 0a35f1953768..727ddcebec9f 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -683,6 +683,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;
+		esas2r_enable_chip_interrupts(a);
 		goto error_exit;
 	}
 
@@ -699,6 +700,7 @@ 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;
+		esas2r_enable_chip_interrupts(a);
 		goto error_exit;
 	}
 
-- 
2.50.1 (Apple Git-155)


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

end of thread, other threads:[~2026-06-11  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  6:41 [PATCH] scsi: esas2r: fix refcount leak in esas2r_resume() WenTao Liang
2026-06-11  6:53 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox