lguest: fix BUG_ON() in invalid guest page table.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 5 Sep 2013 08:15:39 +0000 (17:45 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 5 Sep 2013 22:39:26 +0000 (08:09 +0930)
If we discover the entry is invalid, we kill the guest, but we must
avoid calling gpte_addr() on the invalid pmd, otherwise:

kernel BUG at drivers/lguest/page_tables.c:157!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/lguest/page_tables.c

index a35d8d100165e6efaf1536f90f37aa002b87f1ad..bfb39bb56ef1b3cd03204a9cd010fa81ec418350 100644 (file)
@@ -669,8 +669,10 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr)
 
 #ifdef CONFIG_X86_PAE
        gpmd = lgread(cpu, gpmd_addr(gpgd, vaddr), pmd_t);
-       if (!(pmd_flags(gpmd) & _PAGE_PRESENT))
+       if (!(pmd_flags(gpmd) & _PAGE_PRESENT)) {
                kill_guest(cpu, "Bad address %#lx", vaddr);
+               return -1UL;
+       }
        gpte = lgread(cpu, gpte_addr(cpu, gpmd, vaddr), pte_t);
 #else
        gpte = lgread(cpu, gpte_addr(cpu, gpgd, vaddr), pte_t);