mvumi_internal_cmd_sgl() splits the address of the internal command's data buffer across two u32 fields, lower_32_bits() in baseaddr_l and upper_32_bits() in baseaddr_h. mvumi_delete_internal_cmd() puts it back together with phy_addr = (dma_addr_t) m_sg->baseaddr_l | (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16); but baseaddr_h is a u32, so both shifts happen in 32-bit arithmetic and the result is zero. Every byte of the upper half is dropped, and on a 64-bit host whose DMA mask let the buffer land above 4G, dma_free_coherent() is handed an address that is not the one it returned. Shift in u64 and cast once. Where dma_addr_t is 32 bits the cast truncates to what lower_32_bits() stored, and upper_32_bits() stored zero, so the result is unchanged there. Fixes: f0c568a478f0 ("[SCSI] mvumi: Add Marvell UMI driver") Cc: stable@vger.kernel.org Signed-off-by: Yehyeong Lee --- drivers/scsi/mvumi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); - 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); dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf, phy_addr); -- 2.43.0