Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

John David Anglin and committed by
Helge Deller
d7da660c b7d6f44a

+2 -1
+2 -1
drivers/parisc/ccio-dma.c
··· 1003 1003 ioc->usg_calls++; 1004 1004 #endif 1005 1005 1006 - while(sg_dma_len(sglist) && nents--) { 1006 + while (nents && sg_dma_len(sglist)) { 1007 1007 1008 1008 #ifdef CCIO_COLLECT_STATS 1009 1009 ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; ··· 1011 1011 ccio_unmap_page(dev, sg_dma_address(sglist), 1012 1012 sg_dma_len(sglist), direction, 0); 1013 1013 ++sglist; 1014 + nents--; 1014 1015 } 1015 1016 1016 1017 DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);