summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-05-27 10:59:26 +0930
committerSasha Levin <sasha.levin@oracle.com>2015-06-09 13:43:52 -0400
commit4941509f057cc50ba8420ac5f5e6ffdf8715c02a (patch)
tree06060d69995a8546ecdc41ae6b83e7c747ce18d5
parent45948a314fb5d29f92b8537dcf54888ed78bcecc (diff)
downloadlinux-stable-4941509f057cc50ba8420ac5f5e6ffdf8715c02a.tar.gz
linux-stable-4941509f057cc50ba8420ac5f5e6ffdf8715c02a.tar.bz2
linux-stable-4941509f057cc50ba8420ac5f5e6ffdf8715c02a.zip
lguest: fix out-by-one error in address checking.
[ Upstream commit 83a35114d0e4583e6b0ca39502e68b6a92e2910c ] 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 <rusty@rustcorp.com.au> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--drivers/lguest/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 6590558d1d31..ed70f1e72b24 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -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);
}
/*