From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v8 7/8] scsi: mvumi: fix the DMA address rebuilt in mvumi_delete_internal_cmd()
Date: Thu, 15 Oct 2026 02:38:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-172162@kernel.org> (raw)
In-Reply-To: <20261015022728.3936714-8-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] scsi: mvumi: missing endianness conversion for DMA address SGL fields
- [High] scsi: mvumi: memory corruption due to trusting DMA memory for allocator parameters
--
commit ef0a8e1f55942bcd0c7bbd2536d73b0f59532840
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: mvumi: fix the DMA address rebuilt in mvumi_delete_internal_cmd()
This commit fixes a bug in mvumi_delete_internal_cmd() where a 32-bit shift
on baseaddr_h resulted in truncation of the upper 32 bits of a DMA address.
The fix uses a 64-bit cast before shifting to ensure the address is properly
reconstructed for dma_free_coherent().
Cc: stable@vger.kernel.org
> diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
> index 2410d2aa147d9..bd1a8c1d54aeb 100644
> --- a/drivers/scsi/mvumi.c
> +++ b/drivers/scsi/mvumi.c
> @@ -295,8 +295,8 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba,
> m_sg = (struct mvumi_sgl *) &cmd->frame->payload[0];
> sgd_getsz(mhba, m_sg, size);
[Severity: High]
Does reading the size natively here cause issues on big-endian architectures?
The SGL buffer size is natively read back from a little-endian field in
device DMA memory without using le32_to_cpu().
>
> - phy_addr = (dma_addr_t) m_sg->baseaddr_l |
> - (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16);
> + phy_addr = (dma_addr_t)(((u64)m_sg->baseaddr_h << 32) |
> + m_sg->baseaddr_l);
[Severity: High]
Is it safe to construct this DMA address without endianness conversion?
These SGL fields are populated using cpu_to_le32() but are read back natively.
On big-endian architectures, reading little-endian SGL fields natively yields
corrupted values, which could cause dma_free_coherent() to unmap the wrong
address or trigger a panic.
[Severity: High]
Can a compromised PCIe device modify these fields concurrently?
cmd->frame is allocated in bidirectionally mapped DMA-coherent memory,
so an untrusted device could modify sg_counts, size, baseaddr_h, and baseaddr_l
after they have been initialized or concurrently during cleanup.
Since the driver uses these values directly as parameters for
dma_free_coherent() below, this introduces a DMA double fetch / TOCTOU
vulnerability that could allow arbitrary unmapping of memory.
>
> dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf,
> phy_addr);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015022728.3936714-1-yhlee@isslab.korea.ac.kr?part=7
next prev parent reply other threads:[~2026-10-15 2:38 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
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 [this message]
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-172162@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