[PATCH] [SCSI] advansys: fix host resource leak in EISA probe error path

From: Guangshuo Li

Date: Thu Apr 16 2026 - 13:00:34 EST


A manual code audit found that advansys_eisa_probe() frees saved
Scsi_Host objects directly in its error path.

Those hosts have already been successfully initialized by
advansys_board_found(), so freeing them directly bypasses the normal
teardown path and leaks host resources such as IRQs, DMA or MMIO
resources, and the Scsi_Host release path.

Fix this by releasing the saved hosts with advansys_release() and
dropping their corresponding I/O regions before freeing the probe data.

Fixes: d361db483241 ("[SCSI] advansys: Sort out irq number mess")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/scsi/advansys.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index fcf059bf41e8..022a8190ae31 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -11373,9 +11373,17 @@ static int advansys_eisa_probe(struct device *dev)
return 0;

free_data:
- kfree(data->host[0]);
- kfree(data->host[1]);
- kfree(data);
+ for (i = 0; i < 2; i++) {
+ struct Scsi_Host *shost = data->host[i];
+ int ioport;
+
+ if (!shost)
+ continue;
+
+ ioport = shost->io_port;
+ advansys_release(shost);
+ release_region(ioport, ASC_IOADR_GAP);
+ }
fail:
return err;
}
--
2.43.0