diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-09-05 04:15:39 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-09-05 18:39:26 -0400 |
commit | 4623c28e222d82f87537ef66db61ebcfbd8306db (patch) | |
tree | 7a117043008ff4bd15b5cf8b7baf7e074c1dccba | |
parent | 3b868a4073cdedf395f26d843874414e0e0e9cfd (diff) |
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>
-rw-r--r-- | drivers/lguest/page_tables.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index a35d8d100165..bfb39bb56ef1 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -669,8 +669,10 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr) | |||
669 | 669 | ||
670 | #ifdef CONFIG_X86_PAE | 670 | #ifdef CONFIG_X86_PAE |
671 | gpmd = lgread(cpu, gpmd_addr(gpgd, vaddr), pmd_t); | 671 | gpmd = lgread(cpu, gpmd_addr(gpgd, vaddr), pmd_t); |
672 | if (!(pmd_flags(gpmd) & _PAGE_PRESENT)) | 672 | if (!(pmd_flags(gpmd) & _PAGE_PRESENT)) { |
673 | kill_guest(cpu, "Bad address %#lx", vaddr); | 673 | kill_guest(cpu, "Bad address %#lx", vaddr); |
674 | return -1UL; | ||
675 | } | ||
674 | gpte = lgread(cpu, gpte_addr(cpu, gpmd, vaddr), pte_t); | 676 | gpte = lgread(cpu, gpte_addr(cpu, gpmd, vaddr), pte_t); |
675 | #else | 677 | #else |
676 | gpte = lgread(cpu, gpte_addr(cpu, gpgd, vaddr), pte_t); | 678 | gpte = lgread(cpu, gpte_addr(cpu, gpgd, vaddr), pte_t); |