summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2016-01-29 00:47:51 +0000
committerjsg <jsg@openbsd.org>2016-01-29 00:47:51 +0000
commit237e1892c5bfe2ba57dac911cd4a0f7cc8f43391 (patch)
treefc74ff62348e84c900f5a92cb44853b9a02ac005 /sys
parentsigsuspend is section 2, not 3. (diff)
downloadwireguard-openbsd-237e1892c5bfe2ba57dac911cd4a0f7cc8f43391.tar.xz
wireguard-openbsd-237e1892c5bfe2ba57dac911cd4a0f7cc8f43391.zip
Move a pool_put() to avoid a use after free.
ok mlarkin@ stefan@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/vmm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 8e5fe5cff3f..b7a16037168 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.32 2016/01/25 12:44:16 jsg Exp $ */
+/* $OpenBSD: vmm.c,v 1.33 2016/01/29 00:47:51 jsg Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -2092,12 +2092,11 @@ vm_teardown(struct vm *vm)
/* XXX teardown guest vmspace, free pages */
- pool_put(&vm_pool, vm);
-
vmm_softc->vm_ct--;
if (vmm_softc->vm_ct < 1)
vmm_stop();
rw_exit_write(&vm->vm_vcpu_lock);
+ pool_put(&vm_pool, vm);
}
/*