From: sashiko-bot@kernel.org
To: "Ziheng Wei" <zihengw03@163.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: bvme6000: fix request_irq failure cleanup
Date: Mon, 23 Nov 2026 10:31:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-229048@kernel.org> (raw)
In-Reply-To: <20261123102320.8590-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: 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
prev parent reply other threads:[~2026-11-23 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 10:23 [PATCH] scsi: bvme6000: fix request_irq failure cleanup Ziheng Wei
2026-11-23 10:31 ` sashiko-bot [this message]
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-229048@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox