Skip to content

Commit 75a0386

Browse files
John Garrygregkh
authored andcommitted
scsi: libsas: fix ata xfer length
commit 9702c67c6066f583b629cf037d2056245bb7a8e6 upstream. The total ata xfer length may not be calculated properly, in that we do not use the proper method to get an sg element dma length. According to the code comment, sg_dma_len() should be used after dma_map_sg() is called. This issue was found by turning on the SMMUv3 in front of the hisi_sas controller in hip07. Multiple sg elements were being combined into a single element, but the original first element length was being use as the total xfer length. Fixes: ff2aeb1 ("libata: convert to chained sg") Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a92f411 commit 75a0386

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/scsi/libsas/sas_ata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
218218
task->num_scatter = qc->n_elem;
219219
} else {
220220
for_each_sg(qc->sg, sg, qc->n_elem, si)
221-
xfer += sg->length;
221+
xfer += sg_dma_len(sg);
222222

223223
task->total_xfer_len = xfer;
224224
task->num_scatter = si;

0 commit comments

Comments
 (0)