scsi: dc395x: fix DMA API usage in sg_update_list
authorChristoph Hellwig <hch@lst.de>
Thu, 11 Oct 2018 14:17:15 +0000 (16:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Nov 2019 17:28:27 +0000 (18:28 +0100)
[ Upstream commit 6c404a68bf83b4135a8a9aa1c388ebdf98e8ba7f ]

We need to transfer device ownership to the CPU before we can manipulate
the mapped data.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/dc395x.c

index 9da0ac3..830b2d2 100644 (file)
@@ -1972,6 +1972,11 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
                        xferred -= psge->length;
                } else {
                        /* Partial SG entry done */
+                       pci_dma_sync_single_for_cpu(srb->dcb->
+                                           acb->dev,
+                                           srb->sg_bus_addr,
+                                           SEGMENTX_LEN,
+                                           PCI_DMA_TODEVICE);
                        psge->length -= xferred;
                        psge->address += xferred;
                        srb->sg_index = idx;