diff options
author | John David Anglin <dave.anglin@bell.net> | 2022-01-27 22:33:41 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-23 11:57:32 +0100 |
commit | 993bd4176a27658303fa628ca8e571c77d2f21b8 (patch) | |
tree | f70b891aaf2bcbfda8d0e557d145fc9075f3878a | |
parent | de75676ee99bf9f25b1124ff301b3f7b8ba597d4 (diff) | |
download | linux-stable-993bd4176a27658303fa628ca8e571c77d2f21b8.tar.gz linux-stable-993bd4176a27658303fa628ca8e571c77d2f21b8.tar.bz2 linux-stable-993bd4176a27658303fa628ca8e571c77d2f21b8.zip |
parisc: Fix sglist access in ccio-dma.c
commit d7da660cab47183cded65e11b64497d0f56c6edf upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 d7649a70a0c4..224a36409767 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -1010,7 +1010,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; @@ -1018,6 +1018,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); |