From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] ppc64: iommu vmerge fix]
Date: Thu, 18 Aug 2005 07:32:18 +1000 [thread overview]
Message-ID: <1124314339.8849.32.camel@gaston> (raw)
From: Brian King <brking@us.ibm.com>
(Looks quite bad, should probably get in right away)
The patch below fixes a bug in the PPC64 iommu vmerge code
which results in the potential for iommu_unmap_sg to go off
unmapping more than it should. This was found on a test system
which resulted in PCI bus errors due to PCI memory being
unmapped while DMAs were still in progress.
Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
linux-2.6-bjking1/arch/ppc64/kernel/iommu.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff -puN arch/ppc64/kernel/iommu.c~ppc64_iommu_vmerge_fix arch/ppc64/kernel/iommu.c
--- linux-2.6/arch/ppc64/kernel/iommu.c~ppc64_iommu_vmerge_fix 2005-08-17 15:34:50.000000000 -0500
+++ linux-2.6-bjking1/arch/ppc64/kernel/iommu.c 2005-08-17 15:35:19.000000000 -0500
@@ -242,7 +242,7 @@ int iommu_map_sg(struct device *dev, str
dma_addr_t dma_next = 0, dma_addr;
unsigned long flags;
struct scatterlist *s, *outs, *segstart;
- int outcount;
+ int outcount, incount;
unsigned long handle;
BUG_ON(direction == DMA_NONE);
@@ -252,6 +252,7 @@ int iommu_map_sg(struct device *dev, str
outs = s = segstart = &sglist[0];
outcount = 1;
+ incount = nelems;
handle = 0;
/* Init first segment length for backout at failure */
@@ -338,10 +339,10 @@ int iommu_map_sg(struct device *dev, str
DBG("mapped %d elements:\n", outcount);
- /* For the sake of iommu_free_sg, we clear out the length in the
+ /* For the sake of iommu_unmap_sg, we clear out the length in the
* next entry of the sglist if we didn't fill the list completely
*/
- if (outcount < nelems) {
+ if (outcount < incount) {
outs++;
outs->dma_address = DMA_ERROR_CODE;
outs->dma_length = 0;
_
reply other threads:[~2005-08-17 21:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1124314339.8849.32.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox