From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v7 5/7] scsi: mvumi: reject handshake sizes that overflow the list allocations
Date: Thu, 15 Oct 2026 01:12:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-172083@kernel.org> (raw)
In-Reply-To: <20261015005717.3719956-6-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] scsi: mvumi: newly added handshake bounds check breaks initialization on big-endian systems
--
commit 36e8afa776de38b656fa4baf03b7793afdcd3fef
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: mvumi: reject handshake sizes that overflow the list allocations
This patch adds missing bounds checks in mvumi_hs_process_page() to reject
invalid hardware handshake sizes. It prevents buffer overflows when the
hardware reports excessively large list allocations, capability fields, or
device limits.
> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 18964e860ac8e..8b8e5545747e8 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c
[ ... ]
> @@ -1054,30 +1067,115 @@ static int mvumi_hs_process_page(struct mvumi_hba *mhba,
[ ... ]
> + /*
> + * The page is in coherent DMA memory, so take every field
> + * out of it once: a second fetch of a value that has already
> + * been checked would not be the value that was checked.
> + */
> + in_sz = READ_ONCE(hs_page1->cl_in_max_entry_size);
> + out_sz = READ_ONCE(hs_page1->cl_out_max_entry_size);
> + list_depth = READ_ONCE(hs_page1->cl_inout_list_depth);
> + new_max_io = READ_ONCE(hs_page1->max_io_support);
> + new_max_target_id = READ_ONCE(hs_page1->max_devices_support);
[Severity: High]
Since hs_page1 is populated by the hardware via DMA, aren't these fields
inherently little-endian?
Reading hs_page1->max_devices_support directly into new_max_target_id without
le16_to_cpu() causes the bytes to be swapped on big-endian architectures.
> + new_capability = READ_ONCE(hs_page1->capability);
> + new_max_transfer_size = READ_ONCE(hs_page1->max_transfer_size);
> +
[ ... ]
> + /*
> + * A target above MVUMI_MAX_TARGET_ID cannot be addressed: its
> + * id would land in the LUN byte of device_id and alias another
> + * device. It is also what makes the loop counter in
> + * mvumi_flush_cache() wrap before it reaches the bound.
> + */
> + if (new_max_target_id > MVUMI_MAX_TARGET_ID) {
[Severity: High]
Will this newly added bounds check incorrectly fail the probe on big-endian
systems?
A valid firmware-reported target count of 1 (0x0001) would be byte-swapped
to 256 (0x0100). Since MVUMI_MAX_TARGET_ID is 255, this check would evaluate
256 > 255 as true, falsely log "too many devices reported", and abort the
initialization by returning -1.
> + dev_err(&mhba->pdev->dev,
> + "too many devices reported: %u\n",
> + new_max_target_id);
> + return -1;
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015005717.3719956-1-yhlee@isslab.korea.ac.kr?part=5
next prev parent reply other threads:[~2026-10-15 1:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 0:57 [PATCH v7 0/7] scsi: mvumi: bound the values the firmware supplies Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 1/7] scsi: mvumi: bound the per-event parameter and sense dumps Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 2/7] scsi: mvumi: reject an out-of-range handshake frame length Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 3/7] scsi: mvumi: bound the hotplug event bitmap Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 4/7] scsi: mvumi: walk the hotplug event bitmap a byte at a time Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 5/7] scsi: mvumi: reject handshake sizes that overflow the list allocations Yehyeong Lee
2026-10-15 1:12 ` sashiko-bot [this message]
2026-10-15 0:57 ` [PATCH v7 6/7] scsi: mvumi: validate the response frame tag before using it Yehyeong Lee
2026-10-15 1:10 ` sashiko-bot
2026-10-15 2:07 ` Yehyeong Lee
2026-10-15 0:57 ` [PATCH v7 7/7] scsi: mvumi: fix the DMA address rebuilt in mvumi_delete_internal_cmd() Yehyeong Lee
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-172083@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yhlee@isslab.korea.ac.kr \
/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