mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 02:06:49 +07:00
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 <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
34508f66b6
commit
9a14aefc1d
@ -188,6 +188,14 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address)
|
|||||||
return prot;
|
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)
|
pte_t *lookup_address(unsigned long address, int *level)
|
||||||
{
|
{
|
||||||
pgd_t *pgd = pgd_offset_k(address);
|
pgd_t *pgd = pgd_offset_k(address);
|
||||||
@ -206,7 +214,7 @@ pte_t *lookup_address(unsigned long address, int *level)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*level = PG_LEVEL_2M;
|
*level = PG_LEVEL_2M;
|
||||||
if (pmd_large(*pmd))
|
if (pmd_large(*pmd) || !pmd_present(*pmd))
|
||||||
return (pte_t *)pmd;
|
return (pte_t *)pmd;
|
||||||
|
|
||||||
*level = PG_LEVEL_4K;
|
*level = PG_LEVEL_4K;
|
||||||
|
Loading…
Reference in New Issue
Block a user