From: sashiko-bot@kernel.org
To: "Ziheng Wei" <zihengw03@163.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths
Date: Sun, 22 Nov 2026 16:14:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-228089@kernel.org> (raw)
In-Reply-To: <20261122160447.519889-1-zihengw03@163.com>
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: sysfs use-after-free and DMA leak in
bvme6000_probe() [1]
--
commit 2fe2668801f69445d6459a951360087fb2a1f6f8
Author: Ziheng Wei <zihengw03@163.com>
scsi: 53c700: fix invalid frees in m68k driver remove paths
This commit retrieves hostdata from host->hostdata[0] instead of
shost_priv(host) in the m68k 53c700 driver remove callbacks so kfree()
frees the NCR_700_Host_Parameters allocation rather than an interior
pointer.
[ ... ]
> diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
> index 23301edf100d9..4054f788d1617 100644
> --- a/drivers/scsi/bvme6000_scsi.c
> +++ b/drivers/scsi/bvme6000_scsi.c
> @@ -93,7 +93,8 @@ static void
> bvme6000_device_remove(struct platform_device *dev)
> {
> struct Scsi_Host *host = platform_get_drvdata(dev);
> - struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
> + struct NCR_700_Host_Parameters *hostdata =
> + (struct NCR_700_Host_Parameters *)host->hostdata[0];
>
> scsi_remove_host(host);
> NCR_700_release(host);
[Severity: Critical]
This problem wasn't introduced by this patch, but in bvme6000_probe()
[1], does the request_irq() failure path leave host registered in
sysfs and leak the script DMA memory?
drivers/scsi/bvme6000_scsi.c:bvme6000_probe() {
...
host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata,
&dev->dev);
...
if (request_irq(BVME_IRQ_SCSI, NCR_700_intr, 0, "bvme6000-scsi",
host)) {
printk(KERN_ERR "bvme6000-scsi: request_irq failed\n");
goto out_put_host;
}
...
out_put_host:
scsi_host_put(host);
out_free:
kfree(hostdata);
out:
return -ENODEV;
}
NCR_700_detect() allocates DMA memory for hostdata->script and registers
host via scsi_add_host(). Jumping to out_put_host without calling
scsi_remove_host(host) and NCR_700_release(host) leaks the DMA buffer and
leaves orphaned sysfs entries that can trigger a use-after-free after
hostdata is freed.
[1] https://sashiko.dev/#/bug/linux-a5cb5983-a660-49d3-a7cf-4b23466e8a59
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122160447.519889-1-zihengw03@163.com?part=1
next prev parent reply other threads:[~2026-11-22 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 16:04 [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths Ziheng Wei
2026-11-22 16:14 ` sashiko-bot [this message]
2026-11-23 8:21 ` Geert Uytterhoeven
2026-11-26 3:26 ` Martin K. Petersen
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=sashiko-outbox-228089@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zihengw03@163.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.