Commit 2a46eed54a28c1e3de701ca4237ce4f8bebf14c6

Authored by Al Viro
Committed by Linus Torvalds
1 parent 82023bb7f7

Wrong page freed on preallocate_pmds() failure exit

Note that pmds[i] is simply uninitialized at that point...

Granted, it's very hard to hit (you need split page locks *and*
kmalloc(sizeof(spinlock_t), GFP_KERNEL) failing), but the code is
obviously bogus.

Introduced by commit 09ef4939850a ("x86: add missed
pgtable_pmd_page_ctor/dtor calls for preallocated pmds")

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

arch/x86/mm/pgtable.c
... ... @@ -209,7 +209,7 @@
209 209 if (!pmd)
210 210 failed = true;
211 211 if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) {
212   - free_page((unsigned long)pmds[i]);
  212 + free_page((unsigned long)pmd);
213 213 pmd = NULL;
214 214 failed = true;
215 215 }