Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -1
+3 -1
drivers/lguest/page_tables.c
··· 669 669 670 670 #ifdef CONFIG_X86_PAE 671 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 673 kill_guest(cpu, "Bad address %#lx", vaddr); 674 + return -1UL; 675 + } 674 676 gpte = lgread(cpu, gpte_addr(cpu, gpmd, vaddr), pte_t); 675 677 #else 676 678 gpte = lgread(cpu, gpte_addr(cpu, gpgd, vaddr), pte_t);