pte_alloc_kernel needs additional check
Subsystems (2)
PATCH 1/1 pte_alloc_kernel needs additional check
This applies against 2.5.63.pte_alloc_kernel needs a check for pmd_present(*pmd) at the end.
Thanks,
Paul Larson
mm/memory.c +3 -1
@@ -186,7 +186,9 @@pmd_populate_kernel (mm, pmd, new); } out: -return pte_offset_kernel (pmd, address); +if (pmd_present (*pmd)) +return pte_offset_kernel (pmd, address); +return NULL ; }#define PTE_TABLE_MASK ((PTRS_PER_PTE-1) * sizeof(pte_t))#define PMD_TABLE_MASK ((PTRS_PER_PMD-1) * sizeof(pmd_t))
Quoted 10 lines · Paul Larson
This applies against 2.5.63.
pte_alloc_kernelneeds a check forpmd_present(*pmd)at the end.Thanks,
Paul Larson
mm/memory.c line 194
Quoted 10 lines
mm/memory.c +3
-1@@ -186,7 +186,9 @@pmd_populate_kernel (mm, pmd, new); } out: -return pte_offset_kernel (pmd, address); +if (pmd_present (*pmd)) +return pte_offset_kernel (pmd, address); +return NULL ; }#define PTE_TABLE_MASK ((PTRS_PER_PTE-1) * sizeof(pte_t))#define PMD_TABLE_MASK ((PTRS_PER_PMD-1) * sizeof(pmd_t))
Confused. I cannot see a codepath which makes this test necessary?
Paul Larson <[email protected]> wrote:
- return pte_offset_kernel(pmd, address);
+ if (pmd_present(*pmd))
+ return pte_offset_kernel(pmd, address);
+ return NULL;
Quoted 1 line · Andrew Morton
Confused. I cannot see a codepath which makes this test necessary?
Looks like it's OOM handling by analogy with pte_alloc_map().
-- wli