* [PATCH] scsi: bvme6000: fix request_irq failure cleanup
@ 2026-11-23 10:23 Ziheng Wei
2026-11-23 10:31 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Ziheng Wei @ 2026-11-23 10:23 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-m68k, linux-kernel, Sashiko, stable
NCR_700_detect() registers the SCSI host and allocates the script DMA
memory. If request_irq() fails, bvme6000_probe() only drops the host
reference, leaving the host registered and the DMA memory allocated.
Unregister the host and release the NCR_700 resources before dropping the
reference.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/linux-scsi/sashiko-outbox-228089@kernel.org/
Fixes: 8276b58af4dd ("[SCSI] 53c700: m68k BVME6000 NCR53C710 SCSI")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
---
drivers/scsi/bvme6000_scsi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
--- a/drivers/scsi/bvme6000_scsi.c
+++ b/drivers/scsi/bvme6000_scsi.c
@@ -86,6 +86,8 @@ bvme6000_probe(struct platform_device *dev)
return 0;
out_put_host:
+ scsi_remove_host(host);
+ NCR_700_release(host);
scsi_host_put(host);
out_free:
kfree(hostdata);
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: bvme6000: fix request_irq failure cleanup
2026-11-23 10:23 [PATCH] scsi: bvme6000: fix request_irq failure cleanup Ziheng Wei
@ 2026-11-23 10:31 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-23 10:31 UTC (permalink / raw)
To: Ziheng Wei; +Cc: linux-scsi
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] scsi: bvme6000: invalid free of interior pointer in
bvme6000_device_remove() [1]
--
commit 684af44cd3d918fdbd788ebad664eb615c0eff53
Author: Ziheng Wei <zihengw03@163.com>
scsi: bvme6000: fix request_irq failure cleanup
This commit unregisters the SCSI host and releases NCR_700 DMA resources
before dropping the host reference on the request_irq() error path in
bvme6000_probe().
Link: https://lore.kernel.org/linux-scsi/sashiko-outbox-228089@kernel.org/
> diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
> index 23301edf100d9..81082e754a655 100644
> --- a/drivers/scsi/bvme6000_scsi.c
> +++ b/drivers/scsi/bvme6000_scsi.c
> @@ -82,6 +82,8 @@ bvme6000_probe(struct platform_device *dev)
> return 0;
>
> out_put_host:
> + scsi_remove_host(host);
> + NCR_700_release(host);
> scsi_host_put(host);
> out_free:
> kfree(hostdata);
[Severity: Critical]
This problem wasn't introduced by this patch, but in the corresponding
teardown path in bvme6000_device_remove(), doesn't kfree(hostdata) pass an
interior pointer of struct Scsi_Host [1]?
NCR_700_detect() stores the allocated struct NCR_700_Host_Parameters
pointer in host->hostdata[0], whereas shost_priv(host) returns
&host->hostdata[0]:
drivers/scsi/bvme6000_scsi.c:bvme6000_device_remove() {
struct Scsi_Host *host = platform_get_drvdata(dev);
struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
scsi_remove_host(host);
NCR_700_release(host);
kfree(hostdata);
free_irq(host->irq, host);
}
Calling kfree() on shost_priv(host) corrupts the slab allocator and leaks
the actual hostdata allocation; hostdata should be retrieved from
(struct NCR_700_Host_Parameters *)host->hostdata[0] (and host also needs
scsi_host_put(host)).
[1] https://sashiko.dev/#/bug/linux-c25b18f8-e945-482b-8e44-8cd86f4f0aa1
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123102320.8590-1-zihengw03@163.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 10:23 [PATCH] scsi: bvme6000: fix request_irq failure cleanup Ziheng Wei
2026-11-23 10:31 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox