]> Git Repo - linux.git/commitdiff
Wrong page freed on preallocate_pmds() failure exit
authorAl Viro <[email protected]>
Wed, 20 Nov 2013 22:16:36 +0000 (22:16 +0000)
committerLinus Torvalds <[email protected]>
Wed, 20 Nov 2013 22:22:14 +0000 (14:22 -0800)
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 <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/x86/mm/pgtable.c

index a7cccb6d7fec680e184a57c197106a7d475467b1..36aa999b26318888bc9bf5b39d8966a4e084701a 100644 (file)
@@ -209,7 +209,7 @@ static int preallocate_pmds(pmd_t *pmds[])
                if (!pmd)
                        failed = true;
                if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) {
-                       free_page((unsigned long)pmds[i]);
+                       free_page((unsigned long)pmd);
                        pmd = NULL;
                        failed = true;
                }
This page took 0.062951 seconds and 4 git commands to generate.