Skip to content

Commit 4623c28

Browse files
committed
lguest: fix BUG_ON() in invalid guest page table.
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>
1 parent 3b868a4 commit 4623c28

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/lguest/page_tables.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,10 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr)
669669

670670
#ifdef CONFIG_X86_PAE
671671
gpmd = lgread(cpu, gpmd_addr(gpgd, vaddr), pmd_t);
672-
if (!(pmd_flags(gpmd) & _PAGE_PRESENT))
672+
if (!(pmd_flags(gpmd) & _PAGE_PRESENT)) {
673673
kill_guest(cpu, "Bad address %#lx", vaddr);
674+
return -1UL;
675+
}
674676
gpte = lgread(cpu, gpte_addr(cpu, gpmd, vaddr), pte_t);
675677
#else
676678
gpte = lgread(cpu, gpte_addr(cpu, gpgd, vaddr), pte_t);

0 commit comments

Comments
 (0)