[PATCH] scsi: esas2r: fix refcount leak in esas2r_resume()
From: WenTao Liang
Date: Thu Jun 11 2026 - 02:43:20 EST
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@xxxxxxxxxxxxxxx
Fixes: 26780d9e12ed ("[SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver")
Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
---
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)