From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v8 6/8] scsi: mvumi: validate the response frame tag before using it
Date: Thu, 15 Oct 2026 02:43:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-172173@kernel.org> (raw)
In-Reply-To: <20261015022728.3936714-7-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] scsi: mvumi: missing dma_rmb() causes speculative payload reads
--
commit 3c389f3714e6aa28572a9d4c05ebdfea9ce5674f
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: mvumi: validate the response frame tag before using it
This commit fixes bounds checking and validates the response frame tag
used in the outbound list. It also ensures the tag and request ID are
retrieved using READ_ONCE() to prevent compiler optimizations that could
lead to multiple fetches.
> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 8b8e5545747e8..2410d2aa147d9 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c
[ ... ]
> @@ -546,10 +547,11 @@ static void mvumi_receive_ob_list_entry(struct mvumi_hba *mhba)
> /* Copy pointer may point to entry in outbound list
> * before entry has valid data
> */
> - if (unlikely(p_outb_frame->tag > mhba->tag_pool.size ||
> - mhba->tag_cmd[p_outb_frame->tag] == NULL ||
> - p_outb_frame->request_id !=
> - mhba->tag_cmd[p_outb_frame->tag]->request_id))
> + tag = READ_ONCE(p_outb_frame->tag);
> + if (unlikely(tag >= mhba->tag_pool.size ||
> + !mhba->tag_cmd[tag] ||
> + mhba->tag_cmd[tag]->request_id !=
> + READ_ONCE(p_outb_frame->request_id)))
> if (mvumi_check_ob_frame(mhba, cur_obf, p_outb_frame))
> continue;
>
[Severity: High]
Does this code need a dma_rmb() here?
The driver polls the completion tokens (tag and request_id) in DMA memory
here. A few lines below, the outbound DMA response frame is copied:
mvumi_receive_ob_list_entry() {
...
tag = READ_ONCE(p_outb_frame->tag);
if (unlikely(...))
...
...
memcpy(ob_data->data, p_outb_frame, mhba->ob_max_size);
...
}
Without a dma_rmb() after the completion tokens are validated, can the CPU
speculatively execute the memcpy() of the payload before reading the
completion token?
On weakly ordered architectures, the CPU may read stale values for
req_status or payload during the memcpy(). This could lead to silent data
corruption if a failed disk IO is incorrectly seen as successful.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015022728.3936714-1-yhlee@isslab.korea.ac.kr?part=6
next prev parent reply other threads:[~2026-10-15 2:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 2:27 [PATCH v8 0/8] scsi: mvumi: bound the values the firmware supplies Yehyeong Lee
2026-10-15 2:27 ` [PATCH v8 1/8] scsi: mvumi: bound the per-event parameter and sense dumps Yehyeong Lee
2026-10-15 2:27 ` [PATCH v8 2/8] scsi: mvumi: reject an out-of-range handshake frame length Yehyeong Lee
2026-10-15 2:41 ` sashiko-bot
2026-10-15 2:27 ` [PATCH v8 3/8] scsi: mvumi: bound the hotplug event bitmap Yehyeong Lee
2026-10-15 2:42 ` sashiko-bot
2026-10-15 2:27 ` [PATCH v8 4/8] scsi: mvumi: walk the hotplug event bitmap a byte at a time Yehyeong Lee
2026-10-15 2:27 ` [PATCH v8 5/8] scsi: mvumi: reject handshake sizes that overflow the list allocations Yehyeong Lee
2026-10-15 2:40 ` sashiko-bot
2026-10-15 2:27 ` [PATCH v8 6/8] scsi: mvumi: validate the response frame tag before using it Yehyeong Lee
2026-10-15 2:43 ` sashiko-bot [this message]
2026-10-15 2:27 ` [PATCH v8 7/8] scsi: mvumi: fix the DMA address rebuilt in mvumi_delete_internal_cmd() Yehyeong Lee
2026-10-15 2:38 ` sashiko-bot
2026-10-15 2:27 ` [PATCH v8 8/8] scsi: mvumi: stamp a consumed outbound list entry out of range 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-172173@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