Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a14aefc1d28c6037122965ee8c10d92a970ade0
Commit:     9a14aefc1d28c6037122965ee8c10d92a970ade0
Parent:     34508f66b69ff1708192654f631eb8f1d4c52005
Author:     Thomas Gleixner <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 16:48:07 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Feb 4 16:48:07 2008 +0100

    x86: cpa, fix lookup_address
    
    lookup_address() returns a wrong level and a wrong pointer to a non
    existing pte, when pmd or pud entries are marked !present. This
    happens for example due to boot time mapping of GART into the low
    memory space.
    
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/x86/mm/pageattr.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 3810f7a..7d21cd6 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -188,6 +188,14 @@ static inline pgprot_t static_protections(pgprot_t prot, 
unsigned long address)
        return prot;
 }
 
+/*
+ * Lookup the page table entry for a virtual address. Return a pointer
+ * to the entry and the level of the mapping.
+ *
+ * Note: We return pud and pmd either when the entry is marked large
+ * or when the present bit is not set. Otherwise we would return a
+ * pointer to a nonexisting mapping.
+ */
 pte_t *lookup_address(unsigned long address, int *level)
 {
        pgd_t *pgd = pgd_offset_k(address);
@@ -206,7 +214,7 @@ pte_t *lookup_address(unsigned long address, int *level)
                return NULL;
 
        *level = PG_LEVEL_2M;
-       if (pmd_large(*pmd))
+       if (pmd_large(*pmd) || !pmd_present(*pmd))
                return (pte_t *)pmd;
 
        *level = PG_LEVEL_4K;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to