Skip to content

Commit d7da660

Browse files
danglin44hdeller
authored andcommitted
parisc: Fix sglist access in ccio-dma.c
This patch implements the same bug fix to ccio-dma.c as to sba_iommu.c. It ensures that only the allocated entries of the sglist are accessed. Signed-off-by: John David Anglin <dave.anglin@bell.net> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
1 parent b7d6f44 commit d7da660

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/parisc/ccio-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,15 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
10031003
ioc->usg_calls++;
10041004
#endif
10051005

1006-
while(sg_dma_len(sglist) && nents--) {
1006+
while (nents && sg_dma_len(sglist)) {
10071007

10081008
#ifdef CCIO_COLLECT_STATS
10091009
ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
10101010
#endif
10111011
ccio_unmap_page(dev, sg_dma_address(sglist),
10121012
sg_dma_len(sglist), direction, 0);
10131013
++sglist;
1014+
nents--;
10141015
}
10151016

10161017
DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);

0 commit comments

Comments
 (0)