From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5B632FDC44; Tue, 26 Aug 2025 14:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218759; cv=none; b=ewNQL0rHgS5gDmRhbZtb6jmgvU+0ofT4QXx5Ed/t7zccb6+yVtotQCalOpMuLJfD+PRLAEEy8Qc1sZBZP/znT5kJjCg2aDIqgnI52xlesb0cev1JY7+6WuyR2paE1xfGb+X/GFI2R2Yti5K+ixAajGcpkqeJn7EMRJLfokdPhIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218759; c=relaxed/simple; bh=8wk8llX61pCpUN+jW9Fq1lhk4DefMDj2gs6EOyU2wCQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TjdXaGgxhEiV7r7PBDmAwk9uFhypI9bkmXrDdbbCSfNaWIFcFbSJr89HhFp7SmHeUgVdAzTFhVUyhQDcjqr9qMZaKL0PT81t3kyxn/3yUVSN8n5od8xvxmUSjSQmEDTQEF2sYUTGC2qzajy47sq8Of6TOicMIU6lt49UCS6Ohco= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XPNXxOFo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XPNXxOFo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 351DEC4CEF1; Tue, 26 Aug 2025 14:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756218759; bh=8wk8llX61pCpUN+jW9Fq1lhk4DefMDj2gs6EOyU2wCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPNXxOFoTSV02u7HUpq/AA8ehrsvCm73nP+3NnoIj7kCdBvQgjoObNgDKSE+cNIrR 72U9AKUVjqZQepKh4Y+TZdPNgY3pgU+t5yuV8VrYzPkuOqbVRa76hkwxkqO1RX+jAW jOL2vn3y0zDgexjun7ayvgcrSbhgw/IDfFoLlh6Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Fourier , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 115/403] scsi: mvsas: Fix dma_unmap_sg() nents value Date: Tue, 26 Aug 2025 13:07:21 +0200 Message-ID: <20250826110909.909402940@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110905.607690791@linuxfoundation.org> References: <20250826110905.607690791@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Fourier [ Upstream commit 0141618727bc929fe868153d21797f10ce5bef3f ] The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned. Fixes: b5762948263d ("[SCSI] mvsas: Add Marvell 6440 SAS/SATA driver") Signed-off-by: Thomas Fourier Link: https://lore.kernel.org/r/20250627134822.234813-2-fourier.thomas@gmail.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/mvsas/mv_sas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index 3e0b8ebe257f..68caeaf9e636 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c @@ -831,7 +831,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf dev_printk(KERN_ERR, mvi->dev, "mvsas prep failed[%d]!\n", rc); if (!sas_protocol_ata(task->task_proto)) if (n_elem) - dma_unmap_sg(mvi->dev, task->scatter, n_elem, + dma_unmap_sg(mvi->dev, task->scatter, task->num_scatter, task->data_dir); prep_out: return rc; @@ -882,7 +882,7 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task, if (!sas_protocol_ata(task->task_proto)) if (slot->n_elem) dma_unmap_sg(mvi->dev, task->scatter, - slot->n_elem, task->data_dir); + task->num_scatter, task->data_dir); switch (task->task_proto) { case SAS_PROTOCOL_SMP: -- 2.39.5