From: Guangshuo Li <lgs201920130244@gmail.com>
To: Matthew Wilcox <willy@infradead.org>,
Hannes Reinecke <hare@suse.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@SteelEye.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Guangshuo Li <lgs201920130244@gmail.com>, stable@vger.kernel.org
Subject: [PATCH] [SCSI] advansys: fix host resource leak in EISA probe error path
Date: Fri, 17 Apr 2026 00:59:35 +0800 [thread overview]
Message-ID: <20260416165935.3958686-1-lgs201920130244@gmail.com> (raw)
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@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
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
next reply other threads:[~2026-04-16 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 16:59 Guangshuo Li [this message]
2026-04-16 17:43 ` [PATCH] [SCSI] advansys: fix host resource leak in EISA probe error path Matthew Wilcox
2026-04-17 6:25 ` Guangshuo Li
2026-04-17 5:56 ` Hannes Reinecke
2026-04-17 6:29 ` Guangshuo Li
2026-04-17 6:56 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260416165935.3958686-1-lgs201920130244@gmail.com \
--to=lgs201920130244@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=James.Bottomley@SteelEye.com \
--cc=hare@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox