Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v5 4/6] scsi: mvumi: reject handshake sizes that overflow the list allocations
Date: Wed, 14 Oct 2026 15:31:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-171470@kernel.org> (raw)
In-Reply-To: <20261014151914.3632701-5-yhlee@isslab.korea.ac.kr>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] scsi: mvumi: ring queue desync when firmware limits shrink across reset
--

commit af2767dc7ac6cb07639493635b81a3c6bd8a53fb
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>

scsi: mvumi: reject handshake sizes that overflow the list allocations

This commit adds bounds checking for handshake page sizes to prevent
integer overflows and out-of-bounds writes during allocations. It also
validates that firmware limits do not grow across a host reset.

> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 9e342db4b8383..e63b3ba7eaabd 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c
[ ... ]
> @@ -1054,30 +1067,80 @@ static int mvumi_hs_process_page(struct mvumi_hba *mhba,
>  	}
>  
>  	switch (hs_header->page_code) {
> -	case HS_PAGE_FIRM_CAP:
> +	case HS_PAGE_FIRM_CAP: {
[ ... ]
> +		/* A host reset does not reallocate, so the sizes have to stay
> +		 * the ones the buffers were allocated with.  Only check that
> +		 * the firmware is not asking for more than they hold.
> +		 */
> +		if (mhba->fw_flag & MVUMI_FW_ALLOC) {
> +			if (new_max_io > mhba->max_io ||
> +			    new_ib_max_size > mhba->ib_max_size ||
> +			    new_ob_max_size > mhba->ob_max_size ||
> +			    new_list_num_io > mhba->list_num_io ||
> +			    new_max_target_id > mhba->max_target_id) {
> +				dev_err(&mhba->pdev->dev,
> +					"handshake sizes grew across reset\n");
> +				return -1;
> +			}
> +			break;

[Severity: High]
Does this break statement skip updating the driver's internal limits when the
firmware capacities shrink across a reset?

If a soft reset occurs and the firmware reports smaller capabilities for
list_num_io or max_io, this path is taken because the new values are not
larger than the old ones. However, by breaking out early, the driver misses
updating its internal state to match the smaller firmware limits.

Can this lead to desynchronization of the driver-firmware circular command
rings and overflow of firmware queues?

> +		}
> +
> +		mhba->max_io = new_max_io;
> +		mhba->list_num_io = new_list_num_io;
> +		mhba->max_transfer_size = hs_page1->max_transfer_size;
> +		mhba->max_target_id = new_max_target_id;
> +		mhba->hba_capability = new_capability;
> +		mhba->ib_max_size_setting = hs_page1->cl_in_max_entry_size;
> +		mhba->ib_max_size = new_ib_max_size;
> +		mhba->ob_max_size_setting = hs_page1->cl_out_max_entry_size;
> +		mhba->ob_max_size = new_ob_max_size;
> +
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014151914.3632701-1-yhlee@isslab.korea.ac.kr?part=4

  reply	other threads:[~2026-10-14 15:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 15:19 [PATCH v5 0/6] scsi: mvumi: bound the values the firmware supplies Yehyeong Lee
2026-10-14 15:19 ` [PATCH v5 1/6] scsi: mvumi: bound the per-event parameter and sense dumps Yehyeong Lee
2026-10-14 15:32   ` sashiko-bot
2026-10-14 15:19 ` [PATCH v5 2/6] scsi: mvumi: reject an out-of-range handshake frame length Yehyeong Lee
2026-10-14 15:33   ` sashiko-bot
2026-10-14 15:19 ` [PATCH v5 3/6] scsi: mvumi: bound the hotplug event bitmap Yehyeong Lee
2026-10-14 15:35   ` sashiko-bot
2026-10-14 15:19 ` [PATCH v5 4/6] scsi: mvumi: reject handshake sizes that overflow the list allocations Yehyeong Lee
2026-10-14 15:31   ` sashiko-bot [this message]
2026-10-14 15:19 ` [PATCH v5 5/6] scsi: mvumi: validate the response frame tag before using it Yehyeong Lee
2026-10-14 15:33   ` sashiko-bot
2026-10-14 15:19 ` [PATCH v5 6/6] scsi: mvumi: widen the flush cache loop counter Yehyeong Lee
2026-10-14 15:38   ` sashiko-bot
2026-10-14 16:28 ` [PATCH v5 0/6] scsi: mvumi: bound the values the firmware supplies 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-171470@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