From: sashiko-bot@kernel.org
To: "Louis Sautier" <sautier.louis@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: mpt3sas: Fix out-of-bounds cpu_msix_table read on CPU hotplug
Date: Wed, 18 Nov 2026 20:23:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-221931@kernel.org> (raw)
In-Reply-To: <20261118201316.326943-1-sautier.louis@gmail.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:
- [High] scsi: mpt3sas: ignored non-EAGAIN error in
mpt3sas_base_attach() [1]
--
commit 68d13dcfec52a6dc8ae0711092e3869b07e277ea
Author: Louis Sautier <sautier.louis@gmail.com>
scsi: mpt3sas: Fix out-of-bounds cpu_msix_table read on CPU hotplug
This commit allocates cpu_msix_table with nr_cpu_ids entries instead of
sizing it from the highest online CPU at probe time, and maps all CPUs in
each reply queue's affinity mask so CPUs onlined after probe do not cause
out-of-bounds reads in _base_get_msix_index().
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 5c957044eded1..b33a3e49608dd 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
[ ... ]
> @@ -8409,15 +8406,18 @@ int
> mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
> {
> int r, i, rc;
> - int cpu_id, last_cpu_id = 0;
>
> dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
>
> /* setup cpu_msix_table */
> ioc->cpu_count = num_online_cpus();
> - for_each_online_cpu(cpu_id)
> - last_cpu_id = cpu_id;
> - ioc->cpu_msix_table_sz = last_cpu_id + 1;
> + /*
> + * Allocate an entry for every possible CPU, because
> + * _base_get_msix_index() indexes the table with
> + * raw_smp_processor_id(), which can be a CPU brought online after
> + * the adapter was attached.
> + */
> + ioc->cpu_msix_table_sz = nr_cpu_ids;
> ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL);
> ioc->reply_queue_count = 1;
> if (!ioc->cpu_msix_table) {
[Severity: High]
This problem wasn't introduced by this patch, but later in
mpt3sas_base_attach() [1], does a failure from the first
_base_make_ioc_operational() call get ignored when it returns an error
other than -EAGAIN?
drivers/scsi/mpt3sas/mpt3sas_base.c:mpt3sas_base_attach() {
...
r = _base_make_ioc_operational(ioc);
if (r == -EAGAIN) {
r = _base_make_ioc_operational(ioc);
if (r)
goto out_free_resources;
}
...
return 0;
}
If _base_make_ioc_operational() fails in _base_static_config_pages() or
_base_event_notification() with an error such as -EFAULT,
mpt3sas_base_attach() falls through and returns 0 instead of jumping to
out_free_resources, leaving _scsih_probe() with a partially initialized
adapter.
[1] https://sashiko.dev/#/bug/linux-864ab92c-c52e-45ab-b16b-b4499e83a698
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118201316.326943-1-sautier.louis@gmail.com?part=1
prev parent reply other threads:[~2026-11-18 20:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 20:13 [PATCH] scsi: mpt3sas: Fix out-of-bounds cpu_msix_table read on CPU hotplug Louis Sautier
2026-11-18 20:23 ` 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-221931@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sautier.louis@gmail.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