diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-11-20 14:44:32 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-11-20 14:44:32 +0000 |
commit | 4dbab6dd2afc7685c7ab9c17cde748ead019b078 (patch) | |
tree | d6f02f22eb007d39590f236516961faee1f3a219 /sys | |
parent | 1c2ccba9480a12c2062629fbd8a632fae26d6f58 (diff) |
Check for round_page() overflow in uvm_vslock()/uvm_vsunlock().
ok millert@ henning@ markus@ drahn@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_glue.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c index 883f8e602ec..7f1d57ee4d5 100644 --- a/sys/uvm/uvm_glue.c +++ b/sys/uvm/uvm_glue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_glue.c,v 1.36 2003/11/08 06:11:10 nordin Exp $ */ +/* $OpenBSD: uvm_glue.c,v 1.37 2003/11/20 14:44:31 grange Exp $ */ /* $NetBSD: uvm_glue.c,v 1.44 2001/02/06 19:54:44 eeh Exp $ */ /* @@ -196,6 +196,8 @@ uvm_vslock(p, addr, len, access_type) map = &p->p_vmspace->vm_map; start = trunc_page((vaddr_t)addr); end = round_page((vaddr_t)addr + len); + if (end <= start) + return (EINVAL); rv = uvm_fault_wire(map, start, end, access_type); @@ -215,8 +217,14 @@ uvm_vsunlock(p, addr, len) caddr_t addr; size_t len; { - uvm_fault_unwire(&p->p_vmspace->vm_map, trunc_page((vaddr_t)addr), - round_page((vaddr_t)addr + len)); + vaddr_t start, end; + + start = trunc_page((vaddr_t)addr); + end = round_page((vaddr_t)addr + len); + if (end <= start) + return; + + uvm_fault_unwire(&p->p_vmspace->vm_map, start, end); } /* |