diff options
author | John David Anglin <dave.anglin@bell.net> | 2022-01-27 22:33:41 +0000 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2022-01-28 10:15:34 +0100 |
commit | d7da660cab47183cded65e11b64497d0f56c6edf (patch) | |
tree | 53d3c9619e1242f821bc240409fbf5c9fc3f1db2 /drivers/parisc | |
parent | b7d6f44a0fa716a82969725516dc0b16bc7cd514 (diff) | |
download | linux-d7da660cab47183cded65e11b64497d0f56c6edf.tar.bz2 |
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>
Diffstat (limited to 'drivers/parisc')
-rw-r--r-- | drivers/parisc/ccio-dma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 059566f54429..9be007c9420f 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ioc->usg_calls++; #endif - while(sg_dma_len(sglist) && nents--) { + while (nents && sg_dma_len(sglist)) { #ifdef CCIO_COLLECT_STATS ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; @@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, ccio_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist), direction, 0); ++sglist; + nents--; } DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |