diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 23:55:23 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 07:25:23 -0400 |
commit | 6afbdd059c27330eccbd85943354f94c2b83a7fe (patch) | |
tree | 5b3becb10a07e84c5fedda8c562f5637c091cc04 | |
parent | c5f841f1780dad7efb7eca092f60742d47f47d25 (diff) |
lguest: fix spurious BUG_ON() on invalid guest stack.
Impact: fix crash on misbehaving guest
gpte_addr() contains a BUG_ON(), insisting that the present flag is
set. We need to return before we call it if that isn't the case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
-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 576a8318221c..82ff484bd8c8 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -373,8 +373,10 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr) | |||
373 | /* First step: get the top-level Guest page table entry. */ | 373 | /* First step: get the top-level Guest page table entry. */ |
374 | gpgd = lgread(cpu, gpgd_addr(cpu, vaddr), pgd_t); | 374 | gpgd = lgread(cpu, gpgd_addr(cpu, vaddr), pgd_t); |
375 | /* Toplevel not present? We can't map it in. */ | 375 | /* Toplevel not present? We can't map it in. */ |
376 | if (!(pgd_flags(gpgd) & _PAGE_PRESENT)) | 376 | if (!(pgd_flags(gpgd) & _PAGE_PRESENT)) { |
377 | kill_guest(cpu, "Bad address %#lx", vaddr); | 377 | kill_guest(cpu, "Bad address %#lx", vaddr); |
378 | return -1UL; | ||
379 | } | ||
378 | 380 | ||
379 | gpte = lgread(cpu, gpte_addr(gpgd, vaddr), pte_t); | 381 | gpte = lgread(cpu, gpte_addr(gpgd, vaddr), pte_t); |
380 | if (!(pte_flags(gpte) & _PAGE_PRESENT)) | 382 | if (!(pte_flags(gpte) & _PAGE_PRESENT)) |