Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85dec771 authored by John David Anglin's avatar John David Anglin Committed by Pavel Machek
Browse files

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: default avatarJohn David Anglin <dave.anglin@bell.net>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ca156cb4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -998,7 +998,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;
@@ -1006,6 +1006,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
		ccio_unmap_single(dev, sg_dma_address(sglist),
				  sg_dma_len(sglist), direction);
		++sglist;
		nents--;
	}

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