Skip to content

Commit

Permalink
lguest: fix out-by-one error in address checking.
Browse files Browse the repository at this point in the history
This bug has been there since day 1; addresses in the top guest physical
page weren't considered valid.  You could map that page (the check in
check_gpte() is correct), but if a guest tried to put a pagetable there
we'd check that address manually when walking it, and kill the guest.

Signed-off-by: Rusty Russell <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rustyrussell authored and torvalds committed May 27, 2015
1 parent 3cfd4ba commit 83a3511
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/lguest/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void unmap_switcher(void)
bool lguest_address_ok(const struct lguest *lg,
unsigned long addr, unsigned long len)
{
return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr);
return addr+len <= lg->pfn_limit * PAGE_SIZE && (addr+len >= addr);
}

/*
Expand Down

0 comments on commit 83a3511

Please sign in to comment.