diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-11-21 17:32:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-21 19:42:28 -0500 |
commit | c283610e44ec4ccc412dde8b71cf297ed9515f2f (patch) | |
tree | dd3c83db8dabefbeb3733cd428cced7c62602beb /arch/x86 | |
parent | 3a72660b07d86d60457ca32080b1ce8c2b628ee2 (diff) |
x86, mm: do not leak page->ptl for pmd page tables
There are two code paths how page with pmd page table can be freed:
pmd_free() and pmd_free_tlb().
I've missed the second one and didn't add page table destructor call
there. It leads to leak of page->ptl for pmd page tables, if
dynamically allocated page->ptl is in use.
The patch adds the missed destructor and modifies documentation
accordingly.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Andrey Vagin <avagin@openvz.org>
Tested-by: Andrey Vagin <avagin@openvz.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/pgtable.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 36aa999b2631..c96314abd144 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -61,6 +61,7 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | |||
61 | #if PAGETABLE_LEVELS > 2 | 61 | #if PAGETABLE_LEVELS > 2 |
62 | void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | 62 | void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) |
63 | { | 63 | { |
64 | struct page *page = virt_to_page(pmd); | ||
64 | paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); | 65 | paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); |
65 | /* | 66 | /* |
66 | * NOTE! For PAE, any changes to the top page-directory-pointer-table | 67 | * NOTE! For PAE, any changes to the top page-directory-pointer-table |
@@ -69,7 +70,8 @@ void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | |||
69 | #ifdef CONFIG_X86_PAE | 70 | #ifdef CONFIG_X86_PAE |
70 | tlb->need_flush_all = 1; | 71 | tlb->need_flush_all = 1; |
71 | #endif | 72 | #endif |
72 | tlb_remove_page(tlb, virt_to_page(pmd)); | 73 | pgtable_pmd_page_dtor(page); |
74 | tlb_remove_page(tlb, page); | ||
73 | } | 75 | } |
74 | 76 | ||
75 | #if PAGETABLE_LEVELS > 3 | 77 | #if PAGETABLE_LEVELS > 3 |