From: Venki Pallipadi <venkatesh.pallipadi@intel.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, suresh.b.siddha@intel.com
Subject: [PATCH] x86: PAT bug fix for attribute type check after reserve_memtype
Date: Mon, 24 Mar 2008 14:39:55 -0700 [thread overview]
Message-ID: <20080324213955.GA10456@linux-os.sc.intel.com> (raw)
Bug fixes for reserve_memtype() call in __ioremap and pci_mmap_page_range().
If reserve_memtype returns non-zero, then it is an error and subsequent free is
not required. Requested and returned prot value check should be done when
reserve_memtype returns success.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
arch/x86/mm/ioremap.c | 11 +++++++++--
arch/x86/pci/i386.c | 7 ++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
Index: linux-2.6-x86.git/arch/x86/mm/ioremap.c
===================================================================
--- linux-2.6-x86.git.orig/arch/x86/mm/ioremap.c 2008-03-21 08:28:47.000000000 -0700
+++ linux-2.6-x86.git/arch/x86/mm/ioremap.c 2008-03-24 06:59:09.000000000 -0700
@@ -126,6 +126,7 @@ static void __iomem *__ioremap(unsigned
unsigned long new_prot_val;
pgprot_t prot;
void __iomem *ret_addr;
+ int retval;
/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
@@ -165,8 +166,14 @@ static void __iomem *__ioremap(unsigned
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr+1) - phys_addr;
- if (reserve_memtype(phys_addr, phys_addr + size,
- prot_val, &new_prot_val)) {
+ retval = reserve_memtype(phys_addr, phys_addr + size,
+ prot_val, &new_prot_val);
+ if (retval) {
+ printk("reserve_memtype returned %d\n", retval);
+ return NULL;
+ }
+
+ if (prot_val != new_prot_val) {
/*
* Do not fallback to certain memory types with certain
* requested type:
Index: linux-2.6-x86.git/arch/x86/pci/i386.c
===================================================================
--- linux-2.6-x86.git.orig/arch/x86/pci/i386.c 2008-03-21 08:28:47.000000000 -0700
+++ linux-2.6-x86.git/arch/x86/pci/i386.c 2008-03-24 07:01:22.000000000 -0700
@@ -328,6 +328,7 @@ int pci_mmap_page_range(struct pci_dev *
unsigned long len = vma->vm_end - vma->vm_start;
unsigned long flags;
unsigned long new_flags;
+ int retval;
/* I/O space cannot be accessed via normal processor loads and
* stores on this platform.
@@ -344,7 +345,11 @@ int pci_mmap_page_range(struct pci_dev *
vma->vm_page_prot = __pgprot(prot);
flags = pgprot_val(vma->vm_page_prot) & _PAGE_CACHE_MASK;
- if (reserve_memtype(addr, addr + len, flags, &new_flags)) {
+ retval = reserve_memtype(addr, addr + len, flags, &new_flags);
+ if (retval)
+ return retval;
+
+ if (flags != new_flags) {
/*
* Do not fallback to certain memory types with certain
* requested type:
next reply other threads:[~2008-03-24 21:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-24 21:39 Venki Pallipadi [this message]
2008-03-25 14:33 ` [PATCH] x86: PAT bug fix for attribute type check after reserve_memtype Ingo Molnar
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=20080324213955.GA10456@linux-os.sc.intel.com \
--to=venkatesh.pallipadi@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
/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