From: Jim Paradis <jparadis@redhat.com>
To: marcelo.tosatti@cyclades.com, ak@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix fencepost error in x86_64 IOMMU (2.4)
Date: Tue, 17 Feb 2004 16:14:46 -0500 [thread overview]
Message-ID: <40328446.5030805@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
There's a fencepost error in the GART IOMMU handling on x86_64
in the unmap path. When testing to see if the bus address is
within the IOMMU window and needs to be unmapped, the start of
the first page *beyond* the window also passes the test. This
can cause the first doubleword of the next page beyond the gatt
table to be smashed to zero, with unpredictable results depending
on what that page is used for.
Patch attached for 2.4. The same problem also exists in 2.6,
for which I'll send a separate patch.
[-- Attachment #2: pci-gart-fix-2.4.patch --]
[-- Type: text/plain, Size: 1006 bytes --]
--- linux-2.4.25-rc3/arch/x86_64/kernel/pci-gart.c.orig 2004-02-17 15:21:03.000000000 -0500
+++ linux-2.4.25-rc3/arch/x86_64/kernel/pci-gart.c 2004-02-17 15:23:20.000000000 -0500
@@ -220,7 +220,7 @@ void pci_free_consistent(struct pci_dev
unsigned long iommu_page;
size = round_up(size, PAGE_SIZE);
- if (bus >= iommu_bus_base && bus <= iommu_bus_base + iommu_size) {
+ if (bus >= iommu_bus_base && bus < iommu_bus_base + iommu_size) {
unsigned pages = size >> PAGE_SHIFT;
iommu_page = (bus - iommu_bus_base) >> PAGE_SHIFT;
vaddr = __va(GPTE_DECODE(iommu_gatt_base[iommu_page]));
@@ -353,7 +353,7 @@ void pci_unmap_single(struct pci_dev *hw
unsigned long iommu_page;
int npages;
if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE ||
- dma_addr > iommu_bus_base + iommu_size)
+ dma_addr >= iommu_bus_base + iommu_size)
return;
iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;
npages = round_up(size + (dma_addr & ~PAGE_MASK), PAGE_SIZE) >> PAGE_SHIFT;
next reply other threads:[~2004-02-17 21:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-17 21:14 Jim Paradis [this message]
2004-02-18 21:34 ` [PATCH] Fix fencepost error in x86_64 IOMMU (2.4) Andi Kleen
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=40328446.5030805@redhat.com \
--to=jparadis@redhat.com \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
/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