summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-04-18 16:57:07 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-04-18 16:57:07 +0000
commitc6c339e9b85aa14b18b66feb01bd39fa8edb63bc (patch)
treee78b7a19ae99fba06e094edc41ab6eeec0afa151 /sys/kern
parent6529315db1a2e70197d8a52a3320e9f7810c00c1 (diff)
When vslocking memory for the sysctl make sure that we aren't trying
to wire more memory than we are allowed to. miod@ ok
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 43e7cbec29b..2c7f0459039 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.150 2007/04/12 22:14:15 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.151 2007/04/18 16:57:06 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -188,6 +188,10 @@ sys___sysctl(struct proc *p, void *v, register_t *retval)
if ((error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR)) != 0)
return (error);
if (dolock) {
+ if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) {
+ rw_exit_write(&sysctl_lock);
+ return (ENOMEM);
+ }
error = uvm_vslock(p, SCARG(uap, old), oldlen,
VM_PROT_READ|VM_PROT_WRITE);
if (error) {